delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/12/31/21:43:03

From: fjh AT cs DOT mu DOT OZ DOT AU (Fergus Henderson)
Subject: Re: Linking with -lkernel32 [was: Re: beta18: building gdb gives incomplete import table [and other problems]???]
31 Dec 1997 21:43:03 -0800 :
Message-ID: <19980101161636.43667.cygnus.gnu-win32@mundook.cs.mu.OZ.AU>
References: <34A82DA4 DOT 742F3EDD AT cybec DOT com DOT au>
Mime-Version: 1.0
To: Joao Pedro Sousa <js AT servisoft DOT pt>
Cc: gnu-win32 AT cygnus DOT com

On 31-Dec-1997, Joao Pedro Sousa <js AT servisoft DOT pt> wrote:
> At 12:34 31-12-1997 +1100, Fergus Henderson wrote:
> >...
> >One bug with the linker that has been mentioned on this list previously
> >is that if the same library name is mentioned twice on the link line,
> >then the linker generates executables that crash.  `-lkernel32' is
> >linked in by default, so if you mention it explicitly then it will
> >get linked in twice, causing the symptoms you observed.
> I can't successfully link DLLs (relocatable or non-relocatable) if I don't
> include:
>    -lc -lcygwin -lkernel32 -lc

Whether or not you need to specify `-lkernel32' etc. explicitly
depends on whether you are using `gcc' to do the link, or whether
you are invoking `ld' directly.  If you're using `gcc' to do the link,
it will pass `-lkernel32' etc., so you don't need to (and in fact must not)
specify it yourself.  If you're invoking `ld' directly, then yes you
do need to specify it explicitly.

> If I understand correctly, you use "-lgcc -lcygwin -lkernel32 -lgcc" among
> other obvious things.
> So, should we, or should we not repeat libs?

I think repeating ordinary libraries (e.g. `-lgcc') is OK;
I think it is only DLL import libraries (e.g. `-lcygwin' or `-lkernel32')
that cause problems if they are linked twice.
(However, this is basically just educated guesswork.)

-- 
Fergus Henderson <fjh AT cs DOT mu DOT oz DOT 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 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".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019