There are two types of linking libraries -Static and Dynamic.
Static – Static Link libraries are similar to compiled object files. These object files get linked to the output binary during linking process. These become a part of output binary. Main disadvantage of this linking is –object code takes additional space in memory and code block cannot be shared between processes. To deal with this drawback shared object or dynamic link library has been introduced.
Shared/Dynamic – Shared object (.so) or Dynamic Link Library are object codes those can be shared between processes. System loader loads these objects in memory and shares and links this code to the executable. If there are more process which uses same shared library then this shared block of code can be linked to those processes. Here only one instance of shared object will be in memory and many process can execute that single instance.
Dynamic linking is done by the loader at the loading time of the process. Loader checks import symbols (dynsym)and import libraries and loads individual shared objects accordingly. If one or more objects are already loaded then they need not to be loaded again and only shared code section will be linked to the process. It will populate import table(dynsym) and resolves all external symbols from the shared object. Once linking is done process can execute shared function directly.
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.