Wednesday, January 25, 2012

do you know dynamically loaded libraries?

Apart from Static and Shared Libraries, there is a third type of libraries that are used by programs. These are called dynamically loaded libraries. These libraries are built as normal shared or statically linked libraries.

The difference is that they are not loaded at program startup, instead you would use the dlsym() and dlopen() application programming interface to activate the library. This is how you get web browser plugin's, modules (Apache), or just in time compilers to work. When you are done using the library, you would call dlclose() to remove the library from memory. Errors are handled via the dlerror() application programming interface.

See Dynamic Loading:

 http://en.wikipedia.org/wiki/Dynamic_loading

Dynamic loading is a mechanism by which a computer program can, at run time, load a library (or other binary) into memory, retrieve the addresses of functions and variables contained in the library, execute those functions or access those variables, and unload the library from memory. Unlike static linking and loadtime linking, this mechanism allows a computer program to startup in the absence of these libraries, to discover available libraries, and to potentially gain additional functionality.

No comments:

Post a Comment