Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > relative orderi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 25756 of 27679
Post > Topic >>

relative ordering of static libraries

by kooladi <adi.aquarian@[EMAIL PROTECTED] > Apr 20, 2008 at 09:42 PM

While linking libraries with the final binary, does the relative
ordering of libraries matter? specially for static libraries...

Lets say a.out is being complied with a1.o a2.o a3.o and linked with
lib1.a and lib2.a

a1.o contains a reference to a function resolved within lib1.a
lib2.a also contains a reference to a different function also resolved
within lib1.a.

Now, if the order the libraries as linked is lib1.a & then lib2.a , I
get an implicit dependency error. My guess is that the linker searches
within lib1.a to resolve the unresolved symbol in a1.o. When it is
done resolving, it discards the other functions within lib1.a as it
does not want to bloat the binary with functions it thinks as "un-
necessary".

However, the lib2.a library also contains an un-resolved function
which the linker now has no way of resolving. The only way is to
either reverse their ordering i.e. link lib2.a and then lib1.a or
include lib1.a again i.e lib1.a lib2.a lib1.a

Is my understanding correct ?

What are the other scenarios where the relative ordering of libraries
matter.
 




 8 Posts in Topic:
relative ordering of static libraries
kooladi <adi.aquarian@  2008-04-20 21:42:13 
Re: relative ordering of static libraries
Chris Torek <nospam@[E  2008-04-21 06:59:28 
Re: relative ordering of static libraries
Richard Heathfield <rj  2008-04-21 07:11:38 
Re: relative ordering of static libraries
lawrence.jones@[EMAIL PRO  2008-04-22 20:23:57 
Re: relative ordering of static libraries
kooladi <adi.aquarian@  2008-04-21 02:01:30 
Re: relative ordering of static libraries
roberson@[EMAIL PROTECTED  2008-04-21 11:43:46 
Re: relative ordering of static libraries
CBFalconer <cbfalconer  2008-04-21 20:44:16 
Re: relative ordering of static libraries
Flash Gordon <spam@[EM  2008-04-22 08:31:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 21:17:04 CDT 2008.