A library is a collection of subroutines used to develop software.
A library contains a collection of compiled objects consisting of code and data, which are provided to executable programs. Code and data can thus be shared and changed in a modular fashion.
Operating systems generally provide libraries that handle their system services.
A static library contains subroutines which are copied into a target program at compile-time, producing a stand-alone executable file. Most compiled languages have a standard library (for example, the C standard library) but programmers can also create their own custom libraries.
If dynamic linking is implemented, the library's subroutines are provided to the program at run-time rather than at compile-time, and exist as separate files. Most of the linking is done when the application is loaded (load-time) or during execution (run-time). The linking software, called a loader, is usually part of the operating system.
A major disadvantage of dynamic linking is that the executables depend on the separately stored libraries in order to function properly. If the library becomes unavailable, the executable is likely to malfunction or fail to load.
Remote libraries exist on a separate computer and are called using a remote procedure call (RPC) over a network. The software needed to support the library is the software used to provide support for every other program.
As well as being classified according to whether they are loaded statically or dynamically, libraries can also be classified according to how they are shared among programs. Dynamic libraries almost always offer some form of sharing, allowing the same library to be used by multiple programs at the same time. Static libraries, on the other hand, cannot be shared.
Object-oriented programming (OOP) requires additional information not supplied by traditional libraries. In addition to the names and entry points of code, objects also require a list of objects upon which they depend. This is a side-effect of inheritance, which means that the complete definition of an object may exist in multiple locations.
home | Home Page |