Dynamic Library Loading

Most shared libraries are loaded dynamically when the program is started (on some platforms this behavior can be customized). However, when Netscape starts up, it does not know, for example, that it is going to need the Adobe Acrobat plug-in. The user does not want to wait while Netscape loads every possible plug-in at program startup. Consequently, only when Netscape has determined that it needs Adobe Acrobat support does it call on the dynamic library loader.

Opening the Shared Library

Opening a shared library causes a search for the library file to be performed. Then it is loaded into shared memory and made available for use. The function that accomplishes all of this is the dlopen(3) function:

 #include ...

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.