[Help]: Creating libraries to interface DLLs
Renaud Paquay
rpa@miscrit.be
Fri Mar 14 16:04:00 GMT 1997
> 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.
Example:
--------
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:
---- BEGIN MYDLL.DEF ----
EXPORTS
FunctionA
FunctionB
FunctionC
---- 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
"gnu-win32-request@cygnus.com" with one line of text: "help".
More information about the Cygwin
mailing list