This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Linking with multiple libraries
On Tue, Dec 30, 2008 at 09:23:34PM -0000, Gary Partis wrote:
> When linking to the library, but it requires a second library (also
> specified in the 'ld' command), it does not import the function from the
> second library, but also does not throw an error/warning.
When using static libraries, only needed files will be included
into the final link. Needed means containing a referenced symbol.
The whole archive is not included (unless you use --whole-archive).
Most likely, whatever in the first library calls the second library is
not actually needed to link your application.
> As an aside, how important is it to prefix library names with 'lib'? I am
> using i386-elf-* under Cygwin.
It's just a convention. It works with the compiler's -L and -l
options and various other tools expect it, but the linker does not
care.
--
Daniel Jacobowitz
CodeSourcery