On 09/07/2010 12:24 AM, Al wrote:
How does a program in Gentoo know, where to look for shared libraries?

The program doesn't know.  But the runtime linker does.  And those paths are
in /etc/ld.so.conf.  This file gets updated automatically by portage when
needed.

But... sometimes the program also knows and can link against libraries long
after it has started up using a dlopen() call:

http://linux.die.net/man/3/dlopen


Thank you Nikos. I did read obout this in the Linux HOWTO:

http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html#DL-LIBRARIES

But I was woundering if the /etc/ld.so.conf was only historical stuff.
O.K. is not it's up-to-date. Good to know this.

But it also writes that dlopen() is specific for Linux and Solaris.
There would be alternatives:

  1.) The glib library
  2.) libltdl, which is part of GNU libtool

Now I was woundering, which way would Gentoo choose or if that is not
package specific at all. Are you sure dlopen() is used as a general
approach on Gentoo?

Gentoo doesn't choose anything; it's up to the programs to decide how they want to load libraries at runtime. It's like asking whether Gentoo chooses to use Qt or Gtk to run Firefox; well, since Firefox is a Gtk application and is making calls to Gtk functions, Gentoo doesn't have a say about it.


Reply via email to