[LCP]3 questions...

Paul Gearon pag at pisoftware.com
Mon Jul 28 08:29:02 UTC 2003


I'm confused about your description here.

Vincent Penquerc'h wrote:
 > ld.so will only find it if it knows where to look for (eg, you
 > added the path in /etc/ld.so.conf).

Yes, ld.so will only find things it knows to look for.  The list 
includes a couple of standard directories (/lib, /usr/lib), environment 
variables (eg, LD_LIBRARY_PATH), and what's been stored in the cache. 
Since there's a lot of detail in this I thought that mentioning the man 
pages would be a better option than trying to describe it here.

 > In fact, ldconfif just does that: link to the shared object.

ldconfig does not link to shared objects.  It reads the /etc/ld.so.conf 
file (or whatever file you specify), and builds a binary cache file 
(normally /etc/ld.so.cache).  Then, whenever ld.so needs a library it 
looks in the cache.  You can print the contents of this cache with the 
command "ldconfig -p"

 > But you're right to mention ldconfig as a better way of doing this for
 > "standard" paths to libs.

You just need to make sure ld.so will always be able to find your 
library when you need it.  Environment variables are not usually good 
for this as the variables may not neccessarily be there when you need 
them.  /usr/lib and /lib should be reserved for library files used a lot 
throughout the system (though that's just a policy thing).  For my own 
libraries, or specialised libraries used by a limited set off apps, I 
prefer to add the directories to /etc/ld.so.conf and put them in the 
cache by using ldconfig.

Or have I just misread you, and am getting overly pedantic? (I'm often 
guilty of that, so I could well be doing it again)  :-)

-- 
Regards,
Paul Gearon

Software Engineer                Telephone:   +61 7 3876 2188
Plugged In Software              Fax:         +61 7 3876 4899
http://www.PIsoftware.com        PGP Key available via finger

Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum
immane mittam.
(Translation from latin: "I have a catapult. Give me all the money,
or I will fling an enormous rock at your head.")





More information about the linuxCprogramming mailing list