delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/03/14/16:35:25

From: rpa AT miscrit DOT be (Renaud Paquay)
Subject: Re: [Help]: Creating libraries to interface DLLs
14 Mar 1997 16:35:25 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <332966F0.2E27.cygnus.gnu-win32@miscrit.be>
References: <9703131731 DOT AA29511 AT ehs>
Mime-Version: 1.0
X-Mailer: Mozilla 3.0Gold (WinNT; I)
Original-To: Jonas Nygren <ehsjony AT ehs DOT ericsson DOT se>
Original-CC: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

> 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019