This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: linking in DLLs?


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".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]