delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/01/05/08:00:46

From: marcus AT bighorn DOT dr DOT lucent DOT com
Subject: Re: Linking with -lkernel32 [was: Re: beta18: building gdb gives incomplete import table [and other problems]???]
5 Jan 1998 08:00:46 -0800 :
Message-ID: <199801051547.IAA01973.cygnus.gnu-win32@chorus.dr.lucent.com>
To: gnu-win32 AT cygnus DOT com

Fergus Henderson <fjh AT cs DOT mu DOT OZ DOT AU> writes:
> 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.

This is exactly correct.
 
> > 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.)

This is also exactly correct.  The reason is that there is a delicate dance
done with various sections (.idata$2, etc.) to build the DLL import table.
If a DLL import library is included multiple times, this dance gets out of
step and the import table ends up built incorrectly.

Since archive libraries do not do this, it is not harmful to include them
multiple times.

marcus hall
-
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