This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Linking with multiple libraries


Hi Nick

> > All three (object and two library files) are specified in the linker 
> > command, and it links quite happily.
> >
> > But when doing a objdump, it says one of the library functions is 
> > not present - but it exists in the library...
> 
> Are you linking against a shared (or dynamic) library ?  If so then 
> the library function will not be present in the executable which is 
> why it is not showing up in objdump.

Both libraries are static libraries.

> > Basically, is it possible to make a call to a function from one
> library, to
> > another library; and have the linker to take care of this?
> 
> The linker had taken care of this, you already said so.

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.

However, if both the main program _and_ the first library makes a call to
the second library, the function is imported into the executable.

I hope this makes a little more sense ;-)

As an aside, how important is it to prefix library names with 'lib'? I am
using i386-elf-* under Cygwin.

Kind regards

Gary


-- 
Gary Partis
Partis Computing


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]