Linking with multiple libraries
Nick Clifton
nickc@redhat.com
Wed Dec 31 17:16:00 GMT 2008
Hi Gary,
> Both libraries are static libraries.
> When linking to one static library, it links okay.
>
> 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.
OK - then this is a bug - the linker should be issuing some kind of
error or warning. Please can you provide a small test case that
reproduces the problem so that we can investigate.
It sounds like you need to use the --start-group ... --end-group linker
command line options to enclose the two libraries on the command line.
Have a look at the linker manual for more information.
> As an aside, how important is it to prefix library names with 'lib'? I am
> using i386-elf-* under Cygwin.
Fairly important but not essential. You could also use -l:<filename> to
have the linker treat <filename> as a library, regardless of how
<filename> is formatted. Having libraries start with lib and ending
with .a is a convention, which makes things easier, but it is not an
absolute requirement.
Cheers
Nick
More information about the Binutils
mailing list