theoretically question: is dlopen() loading a update lib or send back the old handler?

Michael Eager eager@eagerm.com
Sun Nov 29 14:07:00 GMT 2015


On 11/27/2015 12:05 PM, Meho wrote:
> Hello mailing-list,
>
> i have a theoretically question to the function dlopen()!
> The manual describes that a loaded library is not loaded again in the
> main memory, if dlopen() is called again. A Handler take a reference
> back to the loaded library.
>
> But what do the function if the library is updated while using? An example:
>
> Program A is started and loaded the library libfoo.so in main memory.
> Now I update the system and the
> libfoo.so (only new release). Program B is starting and call dlopen().
> What will happen?
> Noticed dlopen() the new file and load the new release of the library in
> the memory or get it the handler
> of the loaded library back?

Dlopen() searches the library list to see if it can find the
requested library.  If it finds it, it increments a use count
and returns to the caller.  If it needs to load it, it uses
mmap() to load it into memory.

If you modify the library, the old version of the library
will remain in use until all uses of the library close it.
Program B, loaded after the library was modified, will
see the old version of the library.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Libc-help mailing list