Linking
A library is a collection of subprograms. It is not an independent programs. It provides services to other independent programs.
The linker (or link editor) combines several object files and library files into a single executable.
Static linking includes a copy of the object files from libraries used by a program in the executable. The output file is large but it is a stand-alone executable.
Dynamic linking uses shared libraries which exist in only one location on the entire system. Dynamic linking is carried out at compile time. The resulting executable includes pointers to shared libraries which are loaded by programs when they start. The output file code is much smaller but it depends upon shared libraries installed on the system. Version inconsistencies may cause problems.
Runtime linking also uses shared libraries, but they are not linked against at compile time. It uses the
dlopen()
API. Libraries are loaded only when they are needed (plugin).
- Library (Computer Science) - http://en.wikipedia.org/wiki/Library_(computer_science)
- Linker - http://en.wikipedia.org/wiki/Linker
- Program Library HOWTO - http://tldp.org/HOWTO/Program-Library-HOWTO/
- Linkers and Loaders. Discussing how compilers, links and loaders work and the benefits of shared libraries. http://www.linuxjournal.com/print.php?sid=6463