Page 1 of 1

material about library loading

Posted: Tue Jun 23, 2009 3:34 am
by mcheung63
Hi All
Any PDF or website that talk about how library load the shared library? I want to know what strategy make linux remove the shared library from the memory.
thanks
from Peter ([email protected])

Re: material about library loading

Posted: Tue Jun 23, 2009 9:15 am
by mathematician
I would imagine that, for each library, it keeps a count of how many programs there are in memory which need it. Every time one such program is loaded it increments the count, and every time one such program terminates, it decrements the count. When the count gets down to zero it removes the library from memory. Unless it is being used by the OS itself of course.

Re: material about library loading

Posted: Tue Jun 23, 2009 2:59 pm
by yemista
how would the dynamic linking work? what I mean is, how are programs, compiled against that library, to know where the library is gonna end up being loaded?

Re: material about library loading

Posted: Tue Jun 23, 2009 6:33 pm
by frank
This site http://www.iecc.com/linker/linker10.html seems to have lots of information about ELF dynamic linking.

Re: material about library loading

Posted: Thu Jul 23, 2009 12:48 am
by mcheung63
thank you for the idea
from Peter

Re: material about library loading

Posted: Sun Aug 02, 2009 8:02 pm
by gravaera
yemista wrote:how would the dynamic linking work? what I mean is, how are programs, compiled against that library, to know where the library is gonna end up being loaded?
I've only read about half of the ELF spec so far, and only the bits that would help me load an executable, but form what I remember about Dynamic Linking, the ELF file provides a path to the library it requires. I can't remember whether it provides an absolute address to the symbol/function it wants, or whether it provides simply the symbol name either.

Generally, what I picked up was that the OS resolves the symbols, etc, and points the CPU to the right function based on the Symbol Tables and DYNSYM sections.