From: fjh AT cs DOT mu DOT OZ DOT 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 DOT 0 DOT 5 DOT 32 DOT 19971231005203 DOT 0094d370 AT Spam> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: "Martin 'EmmEss' Svenningsson" Cc: gnu-win32 AT cygnus DOT com On 31-Dec-1997, Martin 'EmmEss' Svenningsson 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 | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh AT 128 DOT 250 DOT 37 DOT 3 | -- the last words of T. S. Garp. - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".