Subject: Re: [Help]: Creating libraries to interface DLLs
From: [email-masked] (Renaud Paquay)

14 Mar 1997 16:35:25 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <9703131731.AA29511@ehs>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0Gold (WinNT; I)
Original-To: Jonas Nygren <[email-masked]>
Original-CC: [email-masked]
Original-Sender: [email-masked]

> 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
"[email-masked]" with one line of text: "help".