Subject: Re: linking in DLLs?
From: [email-masked] (Fergus Henderson)

31 Dec 1997 22:49:30 -0800
Message-ID: <[email-masked]>
References: <3.0.5.32.19971231005203.0094d370@Spam>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: "Martin 'EmmEss' Svenningsson" <[email-masked]>
Cc: [email-masked]

On 31-Dec-1997, Martin 'EmmEss' Svenningsson <[email-masked]> 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 <[email-masked]>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger [email-masked]         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".