Runtime loading of dynamic libraries in Linux
In Linux, libraries which are linked during linking stage of the program, gets loaded during the startup of the program, unless a copy is already present in memory. Another approach provided by Linux operating system is to load/unload the libraries at run time whenever it is needed. API's are provided by Linux for Loading the Library -- dlopen() Looking up for symbols -- dlsym() Handling Errors -- dlerror() Unloading the Library -- dlclose() Header File : #include <dlfcn.h> Note: While building the program, you need to link 'ldl' library: -ldl Flow: 1. Process begins with a call to dlopen API, providing the path of the shared library and the mode. Main two values for this mode are RTLD_NOW, RTLD_LAZY. This informs the dynamic linker when to perform relocations. RTLD_NOW will make all the necessary relocations at the dlopen call time, whereas RTLD_LAZY will perform relocations only when they're needed. dlopen function returns a handle which is...