This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Help]: Creating libraries to interface DLLs

> I need to use DLLs that are not supported by gnu-win32. I have tried to
> use MS based libraries together with GCC in gnu-win32 but have
> failed to get a running application. Is it possible to generate executables
> from a mix of gnu-win32 and MS libraries?

I'm not sure what is the "official" way to do this, but here
is the procedure I used to make it:

You need the ".h" and ".def" file associated to the DLL and the
"dlltool" utility to create the library stub.

Suppose you have a dll named "mydll.dll" and its corresponding
header "mydll.h", which contains 3 functions (FunctionA, FunctionB 
and FunctionC).

1. Create the follwing DEF file:
---- END   MYDLL.DEF ----

2. Execute the following command, which creates "libmydll.a"
dlltool --def mydll.def --dllname mydll.dll --output-lib libmydll.a

3. Compile your C-file with "mydll.h", which contains the
   correct prototypes for FunctionX.
   Do NOT forget to use 'extern "C"' if you're using a C++ compiler.

4. Link your application with "libmydll.a"

5. Be sure "MYDLL.DLL" is in your path or current directory when running
   your application.

Renaud Paquay
Mission Critical
For help on using this list, send a message to
"" with one line of text: "help".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]