From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: linking in DLLs?
31 Dec 1997 22:49:30 -0800
Message-ID: <19980101173110.25136.cygnus.gnu-win32@mundook.cs.mu.OZ.AU>
References: <3.0.5.32.19971231005203.0094d370@Spam>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: "Martin 'EmmEss' Svenningsson" <emmess@bml.rmv.se.org>
Cc: gnu-win32@cygnus.com

On 31-Dec-1997, Martin 'EmmEss' Svenningsson <emmess@bml.rmv.se.org> wrote:
> I may be a bit lame, but how do I link other libs in my DLL's? (non-reloc)

Just add the approproate `-lfoo -lbar' options to the link line when
creating your DLL; they should go after the `.o' files but before any
`-l' options for system libraries (e.g. `-lkernel32').
If you're using my Makefile.DLLs, put these in the LDLIBS variable
(or, if you are buidling multiple DLLs in the same directory, you can
use the variables LDLIBS-foo and LDLIBS-bar).

> I've tried ld foo.dll foo.exp foo.o C:\pathtolibs\libbar.a, but it doesn't
> seem to work.

Well, that would need to be 

	ld --dll -o foo.dll foo.exp foo.o ...
	   ^^^^^^^^

Also depending on which shell you're using, you may need to
escape the \ characters or use Unix-style pathnames
(e.g. //c/pathtolibs/libbar.a).

In addition, I think you'll need to specify `-lkernel32' etc.

Furthermore, I think cygwin.dll doesn't work if it gets relocated;
this may be more likely if you're trying to link with multiple DLLs.

If your program links fine but won't run, then try running your program
under gdb -- this will give you some information about what's happening
with DLLs.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
