In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
, a library is a collection of
non-volatile
Non-volatile memory (NVM) or non-volatile storage is a type of computer memory that can retain stored information even after power is removed. In contrast, volatile memory needs constant power in order to retain data.
Non-volatile memory typic ...
resources used by
computer program
A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components.
A computer program ...
s, often for
software development
Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software components. Software development invol ...
. These may include configuration data, documentation, help data, message templates,
pre-written code and
subroutine
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
Functions may ...
s,
classes,
values
In ethics and social sciences, value denotes the degree of importance of something or action, with the aim of determining which actions are best to do or what way is best to live (normative ethics in ethics), or to describe the significance of dif ...
or
type specifications. In
IBM's OS/360 and its successors they are referred to as
partitioned data sets.
A library is also a collection of implementations of behavior, written in terms of a language, that has a well-defined
interface
Interface or interfacing may refer to:
Academic journals
* ''Interface'' (journal), by the Electrochemical Society
* ''Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics''
* '' Inte ...
by which the behavior is invoked. For instance, people who want to write a higher-level program can use a library to make
system call
In computing, a system call (commonly abbreviated to syscall) is the programmatic way in which a computer program requests a service from the operating system on which it is executed. This may include hardware-related services (for example, acc ...
s instead of implementing those system calls over and over again. In addition, the behavior is provided for reuse by multiple independent programs. A program invokes the library-provided behavior via a mechanism of the language. For example, in a simple
imperative language
In computer science, imperative programming is a programming paradigm of software that uses statements that change a program's state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program c ...
such as
C, the behavior in a library is invoked by using C's normal function-call. What distinguishes the call as being to a library function, versus being to another function in the same program, is the way that the code is organized in the system.
Library code is organized in such a way that it can be used by multiple programs that have no connection to each other, while code that is part of a program is organized to be used only within that one program. This distinction can gain a hierarchical notion when a program grows large, such as a multi-million-line program. In that case, there may be internal libraries that are reused by independent sub-portions of the large program. The distinguishing feature is that a library is organized for the purposes of being reused by independent programs or sub-programs, and the user only needs to know the interface and not the internal details of the library.
The value of a library lies in the reuse of standardized program elements. When a program invokes a library, it gains the behavior implemented inside that library without having to implement that behavior itself. Libraries encourage the sharing of code in a
modular
Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a sy ...
fashion and ease the distribution of the code.
The behavior implemented by a library can be connected to the invoking program at different
program lifecycle phase
{{about, a technical topic, project management, software development process
Program lifecycle phases are the stages a computer program undergoes, from initial creation to deployment and execution. The phases are edit time, compile time, link tim ...
s. If the code of the library is accessed during the build of the invoking program, then the library is called a
static library
In computer science, a static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, produci ...
.
An alternative is to build the executable of the invoking program and distribute that, independently of the library implementation. The library behavior is connected after the executable has been invoked to be executed, either as part of the process of starting the execution, or in the middle of execution. In this case the library is called a
dynamic library
In computing, a dynamic linker is the part of an operating system that loads and links the shared libraries needed by an executable when it is executed (at "run time"), by copying the content of libraries from persistent storage to RAM, filling ...
(loaded at
runtime). A dynamic library can be loaded and linked when preparing a program for execution, by the
linker
Linker or linkers may refer to:
Computing
* Linker (computing), a computer program that takes one or more object files generated by a compiler or generated by an assembler and links them with libraries, generating an executable program or shar ...
. Alternatively, in the middle of execution, an application may explicitly request that a module be
loaded.
Most
compiled language
A compiled language is a programming language whose implementations are typically compilers (translators that generate machine code from source code), and not interpreters (step-by-step executors of source code, where no pre-runtime translation t ...
s have a
standard library
In computer programming, a standard library is the library made available across implementations of a programming language. These libraries are conventionally described in programming language specifications; however, contents of a language's as ...
, although programmers can also create their own custom libraries. Most modern software systems provide libraries that implement the majority of the system services. Such libraries have organized the services which a modern application requires. As such, most code used by modern applications is provided in these system libraries.
History
The idea of a computer library dates back to the first computers created by
Charles Babbage
Charles Babbage (; 26 December 1791 – 18 October 1871) was an English polymath. A mathematician, philosopher, inventor and mechanical engineer, Babbage originated the concept of a digital programmable computer.
Babbage is considered ...
. An 1888 paper on his
Analytical Engine
The Analytical Engine was a proposed mechanical general-purpose computer designed by English mathematician and computer pioneer Charles Babbage. It was first described in 1837 as the successor to Babbage's difference engine, which was a des ...
suggested that computer operations could be punched on separate cards from numerical input. If these operation punch cards were saved for reuse then "by degrees the engine would have a library of its own."
In 1947
Goldstine and
von Neumann Von Neumann may refer to:
* John von Neumann (1903–1957), a Hungarian American mathematician
* Von Neumann family
* Von Neumann (surname), a German surname
* Von Neumann (crater), a lunar impact crater
See also
* Von Neumann algebra
* Von Ne ...
speculated that it would be useful to create a "library" of
subroutine
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
Functions may ...
s for their work on the
IAS machine
The IAS machine was the first electronic computer built at the Institute for Advanced Study (IAS) in Princeton, New Jersey. It is sometimes called the von Neumann machine, since the paper describing its design was edited by John von Neumann, a ...
, an early computer that was not yet operational at that time. They envisioned a physical library of
magnetic wire recording
Wire recording or magnetic wire recording was the first magnetic recording technology, an analog type of audio storage in which a magnetic recording is made on a thin steel wire. The first crude magnetic recorder was invented in 1898 by Valdem ...
s, with each wire storing reusable computer code.
Inspired by von Neumann,
Wilkes and his team constructed
EDSAC
The Electronic Delay Storage Automatic Calculator (EDSAC) was an early British computer. Inspired by John von Neumann's seminal ''First Draft of a Report on the EDVAC'', the machine was constructed by Maurice Wilkes and his team at the Universi ...
. A
filing cabinet
A filing cabinet (or sometimes file cabinet in American English) is a piece of office furniture for storing paper documents in file folders. In the most simple context, it is an enclosure for drawers in which items are stored. The two most commo ...
of
punched tape
Five- and eight-hole punched paper tape
Paper tape reader on the Harwell computer with a small piece of five-hole tape connected in a circle – creating a physical program loop
Punched tape or perforated paper tape is a form of data storage ...
held the subroutine library for this computer. Programs for EDSAC consisted of a main program and a sequence of subroutines copied from the subroutine library. In 1951 the team published the first textbook on programming, ''
The Preparation of Programs for an Electronic Digital Computer
''The Preparation of Programs for an Electronic Digital Computer'' (sometimes called ''WWG'', after its authors' initials) was the first book on computer programming. Published in 1951, it was written by Maurice Wilkes, David Wheeler, and Stanle ...
'', which detailed the creation and the purpose of the library.
COBOL
COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily us ...
included "primitive capabilities for a library system" in 1959,
but
Jean Sammet
Jean may refer to:
People
* Jean (female given name)
* Jean (male given name)
* Jean (surname)
Fictional characters
* Jean Grey, a Marvel Comics character
* Jean Valjean, fictional character in novel ''Les Misérables'' and its adaptations
* Jean ...
described them as "inadequate library facilities" in retrospect.
[Wexelblat, ''op. cit.'', p. 258]
JOVIAL
JOVIAL is a high-level programming language based on ALGOL 58, specialized for developing embedded systems (specialized computer systems designed to perform one or a few dedicated functions, usually embedded as part of a larger, more complete dev ...
had a Communication Pool (COMPOOL), roughly a library of header files.
Another major contributor to the modern library concept came in the form of the
subprogram
In computer programming, a function or subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
Functions may ...
innovation of
FORTRAN. FORTRAN subprograms can be compiled independently of each other, but the compiler lacked a
linker
Linker or linkers may refer to:
Computing
* Linker (computing), a computer program that takes one or more object files generated by a compiler or generated by an assembler and links them with libraries, generating an executable program or shar ...
. So prior to the introduction of modules in Fortran-90,
type checking
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
between FORTRAN
[It was possible earlier between, e.g., Ada subprograms.] subprograms was impossible.
By the mid 1960s, copy and macro libraries for assemblers were common. Starting with the popularity of the
IBM System/360
The IBM System/360 (S/360) is a family of mainframe computer systems that was announced by IBM on April 7, 1964, and delivered between 1965 and 1978. It was the first family of computers designed to cover both commercial and scientific applica ...
, libraries containing other types of text elements, e.g., system parameters, also became common.
Simula
Simula is the name of two simulation programming languages, Simula I and Simula 67, developed in the 1960s at the Norwegian Computing Center in Oslo, by Ole-Johan Dahl and Kristen Nygaard. Syntactically, it is an approximate superset of ALGOL 6 ...
was the first
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
language, and its
classes were nearly identical to the modern concept as used in
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
,
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, and
C#. The ''class'' concept of Simula was also a progenitor of the ''package'' in
Ada
Ada may refer to:
Places
Africa
* Ada Foah, a town in Ghana
* Ada (Ghana parliament constituency)
* Ada, Osun, a town in Nigeria
Asia
* Ada, Urmia, a village in West Azerbaijan Province, Iran
* Ada, Karaman, a village in Karaman Province, Tur ...
and the ''module'' of
Modula-2
Modula-2 is a structured, procedural programming language developed between 1977 and 1985/8 by Niklaus Wirth at ETH Zurich. It was created as the language for the operating system and application software of the Lilith personal workstation. It w ...
.
[Wilson and Clark, ''op. cit.'', p. 52] Even when developed originally in 1965, Simula classes could be included in library files and added at compile time.
[Wexelblat, ''op. cit.'', p. 716]
Linking
Libraries are important in the program ''linking'' or ''binding'' process, which resolves references known as ''links'' or ''symbols'' to library modules. The linking process is usually automatically done by a ''
linker
Linker or linkers may refer to:
Computing
* Linker (computing), a computer program that takes one or more object files generated by a compiler or generated by an assembler and links them with libraries, generating an executable program or shar ...
'' or ''binder'' program that searches a set of libraries and other modules in a given order. Usually it is not considered an error if a link target can be found multiple times in a given set of libraries. Linking may be done when an executable file is created (static linking), or whenever the program is used at
runtime (dynamic linking).
The references being resolved may be addresses for jumps and other routine calls. They may be in the main program, or in one module depending upon another. They are resolved into fixed or relocatable addresses (from a common base) by allocating runtime memory for the
memory segment
Memory segmentation is an operating system memory management technique of division of a computer's primary memory into segments or sections. In a computer system using segmentation, a reference to a memory location includes a value that identifie ...
s of each module referenced.
Some programming languages use a feature called ''smart linking'' whereby the linker is aware of or integrated with the compiler, such that the linker knows how external references are used, and code in a library that is never actually ''used'', even though internally referenced, can be discarded from the compiled application. For example, a program that only uses integers for arithmetic, or does no arithmetic operations at all, can exclude floating-point library routines. This smart-linking feature can lead to smaller application file sizes 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. ''Relocation'' is the process of adjusting these references, and is done either by the linker or the
loader
Loader can refer to:
* Loader (equipment)
* Loader (computing)
** LOADER.EXE, an auto-start program loader optionally used in the startup process of Microsoft Windows ME
* Loader (surname)
* Fast loader
* Speedloader
* Boot loader
** LOADER.COM ...
. In general, relocation cannot be done to individual libraries themselves because the addresses in memory may vary depending on the program using them and other libraries they are combined with.
Position-independent code
In computing, position-independent code (PIC) or position-independent executable (PIE) is a body of machine code that, being placed somewhere in the primary memory, executes properly regardless of its absolute address. PIC is commonly used for ...
avoids references to absolute addresses and therefore does not require relocation.
Static libraries
When linking is performed during the creation of an executable or another object file, it is known as ''static linking'' or ''early binding''. In this case, the linking is usually done by a
linker
Linker or linkers may refer to:
Computing
* Linker (computing), a computer program that takes one or more object files generated by a compiler or generated by an assembler and links them with libraries, generating an executable program or shar ...
, but may also be done by the
compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
. A ''static library'', also known as an ''archive'', is one intended to be statically linked. Originally, only static libraries existed. Static linking must be performed when any modules are recompiled.
All of the modules required by a program are sometimes statically linked and copied into the executable file. This process, and the resulting stand-alone file, is known as a
static build
A static build is a compiled version of a program which has been statically linked against libraries.
Linking
In computer science, linking means taking one or more objects generated by compilers and assembling them into a single executable progr ...
of the program. A static build may not need any further
relocation if
virtual memory
In computing, virtual memory, or virtual storage is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a very l ...
is used and no
address space layout randomization
Address space layout randomization (ASLR) is a computer security technique involved in preventing exploitation of memory corruption vulnerabilities. In order to prevent an attacker from reliably jumping to, for example, a particular exploited fu ...
is desired.
Shared libraries
A shared library or shared object is a file that is intended to be shared by
executable files
In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a data file ...
and further shared
object file
An object file is a computer file containing object code, that is, machine code output of an assembler or compiler. The object code is usually relocatable, and not usually directly executable. There are various formats for object files, and the ...
s. Modules used by a program are loaded from individual shared objects into memory at
load time
In computer systems a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them ...
or
runtime, rather than being copied by a linker when it creates a single monolithic executable file for the program.
Shared libraries can be statically linked during compile-time, meaning that references to the library modules are resolved and the modules are allocated memory when the executable file is created. But often linking of shared libraries is postponed until they are loaded.
Object libraries
Although originally pioneered in the 1960s, dynamic linking did not reach
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s used by consumers until the late 1980s. It was generally available in some form in most operating systems by the early 1990s. During this same period,
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
(OOP) was becoming a significant part of the programming landscape. OOP with runtime binding requires additional information that traditional libraries do not supply. In addition to the names and entry points of the code located within, they also require a list of the objects they depend on. This is a side-effect of one of OOP's core concepts, inheritance, which means that parts of the complete definition of any method may be in different places. This is more than simply listing that one library requires the services of another: in a true OOP system, the libraries themselves may not be known at
compile time
In computer science, compile time (or compile-time) describes the time window during which a computer program is compiled.
The term is used as an adjective to describe concepts related to the context of program compilation, as opposed to concept ...
, and vary from system to system.
At the same time many developers worked on the idea of multi-tier programs, in which a "display" running on a desktop computer would use the services of a
mainframe
A mainframe computer, informally called a mainframe or big iron, is a computer used primarily by large organizations for critical applications like bulk data processing for tasks such as censuses, industry and consumer statistics, enterprise ...
or
minicomputer
A minicomputer, or colloquially mini, is a class of smaller general purpose computers that developed in the mid-1960s and sold at a much lower price than mainframe and mid-size computers from IBM and its direct competitors. In a 1970 survey, ...
for data storage or processing. For instance, a program on a GUI-based computer would send messages to a minicomputer to return small samples of a huge dataset for display.
Remote procedure call
In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (l ...
s (RPC) already handled these tasks, but there was no standard RPC system.
Soon the majority of the minicomputer and mainframe vendors instigated projects to combine the two, producing an OOP library format that could be used anywhere. Such systems were known as object libraries, or distributed objects, if they supported remote access (not all did). Microsoft's COM is an example of such a system for local use. DCOM, a modified version of COM, supports remote access.
For some time object libraries held the status of the "next big thing" in the programming world. There were a number of efforts to create systems that would run across platforms, and companies competed to try to get developers locked into their own system. Examples include
IBM's
System Object Model
In computing, the System Object Model (SOM) is an Object-oriented programming, object-oriented shared library system developed by IBM. DSOM, a distributed version based on CORBA, allowed objects on different computers to communicate.
SOM defin ...
(SOM/DSOM),
Sun Microsystems
Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
'
Distributed Objects Everywhere Distributed Objects Everywhere (DOE) was a long-running Sun Microsystems project to build a distributed computing environment based on the CORBA system in the 'back end' and OpenStep as the user interface. First started in 1990 and announced soon th ...
(DOE),
NeXT
Next may refer to:
Arts and entertainment Film
* ''Next'' (1990 film), an animated short about William Shakespeare
* ''Next'' (2007 film), a sci-fi film starring Nicolas Cage
* '' Next: A Primer on Urban Painting'', a 2005 documentary film
Lit ...
's
Portable Distributed Objects
Portable Distributed Objects (PDO) is an application programming interface (API) for creating object-oriented code that can be executed remotely on a computer network, network of computers. It was created by NeXT Computer, Inc. using their OpenStep ...
(PDO),
Digital
Digital usually refers to something using discrete digits, often binary digits.
Technology and computing Hardware
*Digital electronics, electronic circuits which operate using digital signals
**Digital camera, which captures and stores digital i ...
's
ObjectBroker, Microsoft's
Component Object Model (COM/DCOM), and any number of
CORBA
The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. CORBA enables collaboration between sys ...
-based systems.
Class libraries
Class libraries are the rough OOP equivalent of older types of code libraries. They contain
classes, which describe characteristics and define actions (
methods
Method ( grc, μέθοδος, methodos) literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In recent centuries it more often means a prescribed process for completing a task. It may refer to:
*Scien ...
) that involve objects. Class libraries are used to create
instances, or objects with their characteristics set to specific values. In some OOP languages, like
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
, the distinction is clear, with the classes often contained in library files (like Java's
JAR file format) and the instantiated objects residing only in memory (although potentially able to be made
persistent
Persistent may refer to:
* Persistent data
* Persistent data structure
* Persistent identifier
* Persistent memory
* Persistent organic pollutant
* Persistent Systems, a technology company
* USS ''Persistent'', three United States Navy ships
See ...
in separate files). In others, like
Smalltalk
Smalltalk is an object-oriented, dynamically typed reflective programming language. It was designed and created in part for educational use, specifically for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Ka ...
, the class libraries are merely the starting point for a
system image
In computing, a system image is a serialized copy of the entire state of a computer system stored in some non-volatile form such as a file. A system is said to be capable of using system images if it can be shut down and later restored to exactly ...
that includes the entire state of the environment, classes and all instantiated objects.
Today most class libraries are stored in a
package repository
A software repository, or repo for short, is a storage location for software packages. Often a table of contents is also stored, along with metadata. A software repository is typically managed by source control or repository managers. Package ...
(such as Maven Central for Java). Client code explicitly declare the dependencies to external libraries in
build
Build may refer to:
* Engineering something
* Construction
* Physical body stature, especially muscle size; usually of the human body
* Build (game engine), a 1995 first-person shooter engine
* "Build" (song), a 1987 song by The Housemartins
* ...
configuration files (such as a Maven Pom in Java).
Remote libraries
Another library technique uses completely separate executables (often in some lightweight form) and calls them using a
remote procedure call
In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (l ...
(RPC) over a network to another computer. This maximizes operating system re-use: the code needed to support the library is the same code being used to provide application support and security for every other program. Additionally, such systems do not require the library to exist on the same machine, but can forward the requests over the network.
However, such an approach means that every library call requires a considerable amount of overhead. RPC calls are much more expensive than calling a shared library that has already been loaded on the same machine. This approach is commonly used in a
distributed architecture
A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
that makes heavy use of such remote calls, notably client-server systems and
application server
An application server is a server that hosts applications or software that delivers a business application through a communication protocol.
An application server framework is a service layer model. It includes software components available to a ...
s such as
Enterprise JavaBean
Jakarta Enterprise Beans (EJB; formerly Enterprise JavaBeans) is one of several Java APIs for modular construction of enterprise software. EJB is a server-side software component that encapsulates business logic of an application. An EJB web co ...
s.
Code generation libraries
Code generation libraries are high-level
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
s that can generate or transform
byte code
Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norm ...
for
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
. They are used by
aspect-oriented programming
In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) ''without'' modifying t ...
, some data access frameworks, and for testing to generate dynamic proxy objects. They also are used to intercept field access.
File naming
Most modern Unix-like systems
The system stores
libfoo.a
and
libfoo.so
files in directories such as
/lib
,
/usr/lib
or
/usr/local/lib
. The filenames always start with
lib
, and end with a suffix of
.a
(
archive
An archive is an accumulation of historical records or materials – in any medium – or the physical facility in which they are located.
Archives contain primary source documents that have accumulated over the course of an individual or ...
, static library) or of
.so
(shared object, dynamically linked library). Some systems might have multiple names for a dynamically linked library. These names typically share the same prefix and have different suffixes indicating the version number. Most of the names are names for
symbolic links
In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto.
Symbolic links are supported by POSIX and by most Unix-like operating system ...
to the latest version. For example, on some systems
libfoo.so.2
would be the filename for the second major interface revision of the dynamically linked library
libfoo
. The
.la
files sometimes found in the library directories are
libtool
In computer programming, GNU Libtool is a software development tool, part of the GNU build system, consisting of a shell script created to address the software portability problem when compiling shared libraries from source code.
It hides t ...
archives, not usable by the system as such.
macOS
The system inherits static library conventions from
BSD
The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
, with the library stored in a
.a
file, and can use
.so
-style dynamically linked libraries (with the
.dylib
suffix instead). Most libraries in macOS, however, consist of "frameworks", placed inside special directories called "
bundles" which wrap the library's required files and metadata. For example, a framework called
MyFramework
would be implemented in a bundle called
MyFramework.framework
, with
MyFramework.framework/MyFramework
being either the dynamically linked library file or being a symlink to the dynamically linked library file in
MyFramework.framework/Versions/Current/MyFramework
.
Microsoft Windows
Dynamic-link libraries
Dynamic-link library (DLL) is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems. These libraries usually have the file extension DLL, OCX (for libraries containing ActiveX controls), o ...
usually have the suffix
*.DLL
,
[
] although other file name extensions may identify specific-purpose dynamically linked libraries, e.g.
*.OCX
for
OLE libraries. The interface revisions are either encoded in the file names, or abstracted away using
COM-object interfaces. Depending on how they are compiled,
*.LIB
files can be either static libraries or representations of dynamically linkable libraries needed only during compilation, known as "
import libraries". Unlike in the
UNIX
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
world, which uses different file extensions, when linking against
.LIB
file in
Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
one must first know if it is a regular static library or an import library. In the latter case, a
.DLL
file must be present at runtime.
See also
*
*
*
*
*
*
*
*
*
* (VCL)
* (CLX)
*
*
*
* (used by the
C++ Standard Library
The C standard library or libc is the standard library for the C programming language, as specified in the ISO C standard.ISO/IEC (2018). '' ISO/IEC 9899:2018(E): Programming Languages - C §7'' Starting from the original ANSI C standard, it wa ...
)
*
*
Notes
References
Further reading
* Code
ftp://ftp.iecc.com/pub/linker/] Errata
https://archive.today/20200114224817/https://linker.iecc.com/ 2020-01-14 -->* Article
' by David Drysdale
* Article
' by Léon Bottou and John Ryland
How to Create Program Librariesby Baris Simsek
- the Binary File Descriptor Library
1st Library-Centric Software Design Workshop LCSD'05 at OOPSLA'05
2nd Library-Centric Software Design Workshop LCSD'06at OOPSLA'06
How to create shared libraryby Ulrich Drepper (with much background info)
Anatomy of Linux dynamic librariesat IBM.com
{{DEFAULTSORT:Library (Computing)
Computer libraries,
Operating system technology