Library (computing)
In
A library can be used by multiple, independent consumers (programs and other libraries). This differs from resources defined in a program which can usually only be used by that program. When a consumer uses a library resource, it gains the value of the library without having to implement it itself. Libraries encourage
When writing code that uses a library, a programmer only needs to know how to use it – not its the internal details. For example, a program could use a library that abstracts a complicated system call so that the programmer can use the system feature without spending time to learn the intricacies of the system function.
History
The idea of a computer library dates back to the first computers created by

In 1947
Inspired by von Neumann, Wilkes and his team constructed EDSAC. A filing cabinet of punched tape held the subroutine library for this computer.[4] Programs for EDSAC consisted of a main program and a sequence of subroutines copied from the subroutine library.[5] In 1951 the team published the first textbook on programming, The Preparation of Programs for an Electronic Digital Computer, which detailed the creation and the purpose of the library.[6]
COBOL included "primitive capabilities for a library system" in 1959,[7] but Jean Sammet described them as "inadequate library facilities" in retrospect.[8]
JOVIAL has a Communication Pool (COMPOOL), roughly a library of header files.
Another major contributor to the modern library concept came in the form of the
By the mid 1960s, copy and macro libraries for assemblers were common. Starting with the popularity of the IBM System/360, libraries containing other types of text elements, e.g., system parameters, also became common.
In IBM's OS/360 and its successors this is called a partitioned data set.
The first
Linking
The linking (or binding) process resolves references known as symbols (or links) by searching for them in various locations including configured libraries. If a linker (or binder) does not find a symbol, then it fails, but multiple matches may or may not cause failure.
Static linking is linking at
Smart linking is performed by a build tool that excludes unused code in the linking process. For example, a program that only uses integers for arithmetic, or does no arithmetic operations at all, can exclude floating-point library routines. This can lead to smaller program file size and reduced memory usage.
Relocation
Some references in a program or library module are stored in a relative or symbolic form which cannot be resolved until all code and libraries are assigned final static addresses.
Categories
Executable
An executable library consists of code that has been converted from source code into machine code or an intermediate form such as bytecode. A linker allows for using library objects by associating each reference with an address at which the object is located. For example, in C, a library function is invoked via C's normal function call syntax and semantics.[12]
A variant is a library containing compiled code (object code in IBM's nomenclature) in a form that cannot be loaded by the OS but that can be read by the linker.
Static
A
A static library is sometimes called an archive on Unix-like systems.
Dynamic
A
Source
A source library consists of source code; not compiled code.
Shared
A
Object
Although generally an obsolete technology today, an object library exposes resources for
The object library technology was developed since as OOP became popular, it became apparent that OOP runtime binding required information than contemporary libraries did not provide. In addition to the names and entry points of the code located within, due to inheritance, OOP binding also requires a list of dependencies – since the full definition of a method may be in different places. Further, this requires more than listing that one library requires the services of another. In OOP, the libraries themselves may not be known at compile time, and vary from system to system.
The remote object technology was developed in parallel to support multi-tier programs with a user interface application running on a personal computer (PC) using services of a mainframe or minicomputer such as data storage and processing. For instance, a program on a PC would send messages to a minicomputer via remote procedure call (RPC) to retrieve relatively small samples from a relatively large dataset. In response, distrubuted object technology was developed.
Class
A class library contains
Remote
A remote library runs on another computer and its assets are accessed via remote procedure call (RPC) over a network. This distributed architecture allows for minimizing installation of the library and support for it on each consuming system and ensuring consistent versioning. A significant downside is that each library call entails significantly more overhead than for a local library.
Runtime
A
Language standard
Many modern
Code generation
A code generation library has a high-level
File naming
Unix-like
On most modern
.so
for a shared object (dynamically linked library). For example, libfoo.a
and libfoo.so
.
Often, symbolic link files are used to manage versioning of a library by providing a link file named without a version that links to a file named with a version. For example, libfoo.so.2
might be version 2 of library foo and a link file named libfoo.so
provides a version independent name to that file that programs link to. The link file could be changed to a refer to a version 3 (libfoo.so.3
) such that consuming programs will then use version 3 without having to change the program.
Files with extension .la
are
macOS
The
.a
file. It uses either .so
or .dylib
for dynamic libraries. Most libraries in macOS, however, consist of "frameworks", placed inside special directories called "bundlesAbc
would be implemented in a bundle called Abc.framework
, with Abc.framework/Abc
being either the dynamically linked library file or a symlink to the dynamically linked library file in Abc.framework/Versions/Current/Abc
.
Windows
Often, a Windows dynamic-link library (DLL) has the file extension .dll
,[20] although sometimes different extensions are used to indicate general content, e.g. .ocx
for a OLE library.
A .lib
file can be either a static library or contain the information needed to build an application that consumes the associated DLL. In the latter case, the associated DLL file must be present at runtime.
See also
- Code reuse – Using existing code in new software
- Object file – File containing relocatable format machine code
- Plug-in – Software component that extends the functionality of existing software
- Prelink, also known as prebinding
- Runtime library – Access to a program's runtime environment
- Visual Component Library – Object Pascal framework for Windows (VCL)
- Component Library for Cross Platform (CLX)
- C standard library – Standard library for the C programming language
- Java Class Library – standard library for Java and other JVM programming languages
- Framework Class Library – Standard library of Microsoft's .NET Framework
- Generic programming – Style of computer programming (used by the C++ Standard Library)
- soname – Field of data in a shared object file
- Method stub – Short and simple version of a method
Notes
- ^ It was possible earlier between, e.g., Ada subprograms.
References
- ^ Babbage, H. P. (1888-09-12). "The Analytical Engine". Proceedings of the British Association. Bath.
- ISBN 978-1-4008-2013-9.
- OCLC 26239859.
it will probably be very important to develop an extensive "library" of subroutines
- .
- S2CID 20261972.
- OCLC 641145988.
- ISBN 0-12-745040-8.
- ^ Wexelblat, op. cit., p. 258
- ISBN 0-201-18483-4.
- ^ Wilson and Clark, op. cit., p. 52
- ^ Wexelblat, op. cit., p. 716
- .
- ^ "Static Libraries". TLDP. Archived from the original on 2013-07-03. Retrieved 2013-10-03.
- ISBN 978-1-59749-237-9. Retrieved 2021-05-27.
- ^ Collberg, Christian; Hartman, John H.; Babu, Sridivya; Udupa, Sharath K. (2003). SLINKY: Static Linking Reloaded. USENIX '05. Department of Computer Science, University of Arizona. Archived from the original on 2016-03-23. Retrieved 2016-03-17.
- ISBN 1-55860-496-0.
- ISBN 0-13-944877-2.
- ^ "Shared Libraries in SunOS" (PDF). pp. 1, 3.
- Source Forge. Archivedfrom the original on 2010-01-12. Retrieved 2010-03-03.
Byte Code Generation Library is high level API to generate and transform JAVA byte code. It is used by AOP, testing, data access frameworks to generate dynamic proxy objects and intercept field access.
- ^
Bresnahan, Christine; Blum, Richard (2015-04-27). LPIC-1 Linux Professional Institute Certification Study Guide: Exam 101-400 and Exam 102-400. John Wiley & Sons (published 2015). p. 82. ISBN 9781119021186. Archivedfrom the original on 2015-09-24. Retrieved 2015-09-03.
Linux shared libraries are similar to the dynamic link libraries (DLLs) of Windows. Windows DLLs are usually identified by
.dll
filename extensions.
Further reading
- Article Beginner's Guide to Linkers by David Drysdale
- Article Faster C++ program startups by improving runtime linking efficiency by Léon Bottou and John Ryland
- How to Create Program Libraries by Baris Simsek
- BFD - the Binary File Descriptor Library
- 1st Library-Centric Software Design Workshop LCSD'05 Archived 2019-08-28 at the Wayback Machine at OOPSLA'05
- 2nd Library-Centric Software Design Workshop LCSD'06 at OOPSLA'06
- How to create shared library by Ulrich Drepper (with much background info)
- Anatomy of Linux dynamic libraries at IBM.com