<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
library	O
is	O
a	O
collection	O
of	O
non-volatile	B-General_Concept
resources	O
used	O
by	O
computer	B-Application
programs	I-Application
,	O
often	O
for	O
software	O
development	O
.	O
</s>
<s>
In	O
IBM	B-Application
's	I-Application
OS/360	I-Application
and	I-Application
its	I-Application
successors	I-Application
they	O
are	O
referred	O
to	O
as	O
partitioned	O
data	O
sets	O
.	O
</s>
<s>
A	O
library	O
is	O
also	O
a	O
collection	O
of	O
implementations	O
of	O
behavior	O
,	O
written	O
in	O
terms	O
of	O
a	O
language	O
,	O
that	O
has	O
a	O
well-defined	O
interface	B-Application
by	O
which	O
the	O
behavior	O
is	O
invoked	O
.	O
</s>
<s>
For	O
instance	O
,	O
people	O
who	O
want	O
to	O
write	O
a	O
higher-level	O
program	O
can	O
use	O
a	O
library	O
to	O
make	O
system	B-Operating_System
calls	I-Operating_System
instead	O
of	O
implementing	O
those	O
system	B-Operating_System
calls	I-Operating_System
over	O
and	O
over	O
again	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
a	O
simple	O
imperative	B-Application
language	I-Application
such	O
as	O
C	B-Language
,	O
the	O
behavior	O
in	O
a	O
library	O
is	O
invoked	O
by	O
using	O
C	B-Language
's	O
normal	O
function-call	O
.	O
</s>
<s>
The	O
distinguishing	O
feature	O
is	O
that	O
a	O
library	O
is	O
organized	O
for	O
the	O
purposes	O
of	O
being	O
reused	O
by	O
independent	O
programs	O
or	O
sub-programs	O
,	O
and	O
the	O
user	O
only	O
needs	O
to	O
know	O
the	O
interface	B-Application
and	O
not	O
the	O
internal	O
details	O
of	O
the	O
library	O
.	O
</s>
<s>
Libraries	O
encourage	O
the	O
sharing	O
of	O
code	O
in	O
a	O
modular	B-Architecture
fashion	O
and	O
ease	O
the	O
distribution	O
of	O
the	O
code	O
.	O
</s>
<s>
The	O
behavior	O
implemented	O
by	O
a	O
library	O
can	O
be	O
connected	O
to	O
the	O
invoking	O
program	O
at	O
different	O
program	B-Application
lifecycle	I-Application
phases	I-Application
.	O
</s>
<s>
If	O
the	O
code	O
of	O
the	O
library	O
is	O
accessed	O
during	O
the	O
build	O
of	O
the	O
invoking	O
program	O
,	O
then	O
the	O
library	O
is	O
called	O
a	O
static	B-Library
library	I-Library
.	O
</s>
<s>
An	O
alternative	O
is	O
to	O
build	O
the	O
executable	B-Application
of	O
the	O
invoking	O
program	O
and	O
distribute	O
that	O
,	O
independently	O
of	O
the	O
library	O
implementation	O
.	O
</s>
<s>
The	O
library	O
behavior	O
is	O
connected	O
after	O
the	O
executable	B-Application
has	O
been	O
invoked	O
to	O
be	O
executed	O
,	O
either	O
as	O
part	O
of	O
the	O
process	B-Operating_System
of	O
starting	O
the	O
execution	O
,	O
or	O
in	O
the	O
middle	O
of	O
execution	O
.	O
</s>
<s>
In	O
this	O
case	O
the	O
library	O
is	O
called	O
a	O
dynamic	B-Application
library	I-Application
(	O
loaded	B-Operating_System
at	B-Library
runtime	I-Library
)	O
.	O
</s>
<s>
A	O
dynamic	B-Application
library	I-Application
can	O
be	O
loaded	B-Operating_System
and	O
linked	O
when	O
preparing	O
a	O
program	O
for	O
execution	O
,	O
by	O
the	O
linker	B-Application
.	O
</s>
<s>
Alternatively	O
,	O
in	O
the	O
middle	O
of	O
execution	O
,	O
an	O
application	O
may	O
explicitly	O
request	O
that	O
a	O
module	B-Architecture
be	O
loaded	B-Operating_System
.	O
</s>
<s>
Most	O
compiled	B-Language
languages	I-Language
have	O
a	O
standard	B-Library
library	I-Library
,	O
although	O
programmers	O
can	O
also	O
create	O
their	O
own	O
custom	O
libraries	O
.	O
</s>
<s>
An	O
1888	O
paper	O
on	O
his	O
Analytical	B-Device
Engine	I-Device
suggested	O
that	O
computer	O
operations	O
could	O
be	O
punched	O
on	O
separate	O
cards	O
from	O
numerical	O
input	O
.	O
</s>
<s>
In	O
1947	O
Goldstine	O
and	O
von	O
Neumann	O
speculated	O
that	O
it	O
would	O
be	O
useful	O
to	O
create	O
a	O
"	O
library	O
"	O
of	O
subroutines	O
for	O
their	O
work	O
on	O
the	O
IAS	B-Device
machine	I-Device
,	O
an	O
early	O
computer	O
that	O
was	O
not	O
yet	O
operational	O
at	O
that	O
time	O
.	O
</s>
<s>
They	O
envisioned	O
a	O
physical	O
library	O
of	O
magnetic	O
wire	O
recordings	O
,	O
with	O
each	O
wire	O
storing	O
reusable	O
computer	B-Application
code	I-Application
.	O
</s>
<s>
Inspired	O
by	O
von	O
Neumann	O
,	O
Wilkes	O
and	O
his	O
team	O
constructed	O
EDSAC	B-Device
.	O
</s>
<s>
Programs	O
for	O
EDSAC	B-Device
consisted	O
of	O
a	O
main	O
program	O
and	O
a	O
sequence	O
of	O
subroutines	O
copied	O
from	O
the	O
subroutine	O
library	O
.	O
</s>
<s>
COBOL	B-Application
included	O
"	O
primitive	O
capabilities	O
for	O
a	O
library	O
system	O
"	O
in	O
1959	O
,	O
but	O
Jean	O
Sammet	O
described	O
them	O
as	O
"	O
inadequate	O
library	O
facilities	O
"	O
in	O
retrospect	O
.	O
</s>
<s>
JOVIAL	B-Language
had	O
a	O
Communication	O
Pool	O
(	O
COMPOOL	O
)	O
,	O
roughly	O
a	O
library	O
of	O
header	O
files	O
.	O
</s>
<s>
Another	O
major	O
contributor	O
to	O
the	O
modern	O
library	O
concept	O
came	O
in	O
the	O
form	O
of	O
the	O
subprogram	O
innovation	O
of	O
FORTRAN	B-Application
.	O
</s>
<s>
FORTRAN	B-Application
subprograms	O
can	O
be	O
compiled	B-Language
independently	O
of	O
each	O
other	O
,	O
but	O
the	O
compiler	B-Language
lacked	O
a	O
linker	B-Application
.	O
</s>
<s>
So	O
prior	O
to	O
the	O
introduction	O
of	O
modules	B-Architecture
in	O
Fortran-90	O
,	O
type	O
checking	O
between	O
FORTRAN	B-Application
subprograms	O
was	O
impossible	O
.	O
</s>
<s>
Starting	O
with	O
the	O
popularity	O
of	O
the	O
IBM	B-Application
System/360	I-Application
,	O
libraries	O
containing	O
other	O
types	O
of	O
text	O
elements	O
,	O
e.g.	O
,	O
system	O
parameters	O
,	O
also	O
became	O
common	O
.	O
</s>
<s>
Simula	B-Language
was	O
the	O
first	O
object-oriented	B-Language
programming	I-Language
language	I-Language
,	O
and	O
its	O
classes	O
were	O
nearly	O
identical	O
to	O
the	O
modern	O
concept	O
as	O
used	O
in	O
Java	B-Language
,	O
C++	B-Language
,	O
and	O
C#	B-Application
.	O
</s>
<s>
The	O
class	O
concept	O
of	O
Simula	B-Language
was	O
also	O
a	O
progenitor	O
of	O
the	O
package	O
in	O
Ada	B-Language
and	O
the	O
module	B-Architecture
of	O
Modula-2	B-Language
.	O
</s>
<s>
Even	O
when	O
developed	O
originally	O
in	O
1965	O
,	O
Simula	B-Language
classes	O
could	O
be	O
included	O
in	O
library	O
files	O
and	O
added	O
at	O
compile	B-Application
time	I-Application
.	O
</s>
<s>
Libraries	O
are	O
important	O
in	O
the	O
program	O
linking	B-Application
or	O
binding	O
process	B-Operating_System
,	O
which	O
resolves	O
references	O
known	O
as	O
links	O
or	O
symbols	O
to	O
library	O
modules	B-Architecture
.	O
</s>
<s>
The	O
linking	B-Application
process	B-Operating_System
is	O
usually	O
automatically	O
done	O
by	O
a	O
linker	B-Application
or	O
binder	O
program	O
that	O
searches	O
a	O
set	O
of	O
libraries	O
and	O
other	O
modules	B-Architecture
in	O
a	O
given	O
order	O
.	O
</s>
<s>
Linking	B-Application
may	O
be	O
done	O
when	O
an	O
executable	B-Application
file	I-Application
is	O
created	O
(	O
static	B-Library
linking	I-Library
)	O
,	O
or	O
whenever	O
the	O
program	O
is	O
used	O
at	B-Library
runtime	I-Library
(	O
dynamic	B-Application
linking	I-Application
)	O
.	O
</s>
<s>
They	O
may	O
be	O
in	O
the	O
main	O
program	O
,	O
or	O
in	O
one	O
module	B-Architecture
depending	O
upon	O
another	O
.	O
</s>
<s>
They	O
are	O
resolved	O
into	O
fixed	O
or	O
relocatable	O
addresses	O
(	O
from	O
a	O
common	O
base	O
)	O
by	O
allocating	O
runtime	B-Library
memory	O
for	O
the	O
memory	B-General_Concept
segments	I-General_Concept
of	O
each	O
module	B-Architecture
referenced	O
.	O
</s>
<s>
Some	O
programming	O
languages	O
use	O
a	O
feature	O
called	O
smart	O
linking	B-Application
whereby	O
the	O
linker	B-Application
is	O
aware	O
of	O
or	O
integrated	O
with	O
the	O
compiler	B-Language
,	O
such	O
that	O
the	O
linker	B-Application
knows	O
how	O
external	O
references	O
are	O
used	O
,	O
and	O
code	O
in	O
a	O
library	O
that	O
is	O
never	O
actually	O
used	O
,	O
even	O
though	O
internally	O
referenced	O
,	O
can	O
be	O
discarded	O
from	O
the	O
compiled	B-Language
application	O
.	O
</s>
<s>
This	O
smart-linking	O
feature	O
can	O
lead	O
to	O
smaller	O
application	O
file	O
sizes	O
and	O
reduced	O
memory	O
usage	O
.	O
</s>
<s>
Some	O
references	O
in	O
a	O
program	O
or	O
library	O
module	B-Architecture
are	O
stored	O
in	O
a	O
relative	O
or	O
symbolic	O
form	O
which	O
cannot	O
be	O
resolved	O
until	O
all	O
code	O
and	O
libraries	O
are	O
assigned	O
final	O
static	O
addresses	O
.	O
</s>
<s>
Relocation	B-Library
is	O
the	O
process	B-Operating_System
of	O
adjusting	O
these	O
references	O
,	O
and	O
is	O
done	O
either	O
by	O
the	O
linker	B-Application
or	O
the	O
loader	B-Operating_System
.	O
</s>
<s>
In	O
general	O
,	O
relocation	B-Library
cannot	O
be	O
done	O
to	O
individual	O
libraries	O
themselves	O
because	O
the	O
addresses	O
in	O
memory	O
may	O
vary	O
depending	O
on	O
the	O
program	O
using	O
them	O
and	O
other	O
libraries	O
they	O
are	O
combined	O
with	O
.	O
</s>
<s>
Position-independent	B-Operating_System
code	I-Operating_System
avoids	O
references	O
to	O
absolute	O
addresses	O
and	O
therefore	O
does	O
not	O
require	O
relocation	B-Library
.	O
</s>
<s>
When	O
linking	B-Application
is	O
performed	O
during	O
the	O
creation	O
of	O
an	O
executable	B-Application
or	O
another	O
object	B-Application
file	I-Application
,	O
it	O
is	O
known	O
as	O
static	B-Library
linking	I-Library
or	O
early	O
binding	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
linking	B-Application
is	O
usually	O
done	O
by	O
a	O
linker	B-Application
,	O
but	O
may	O
also	O
be	O
done	O
by	O
the	O
compiler	B-Language
.	O
</s>
<s>
A	O
static	B-Library
library	I-Library
,	O
also	O
known	O
as	O
an	O
archive	B-Application
,	O
is	O
one	O
intended	O
to	O
be	O
statically	O
linked	O
.	O
</s>
<s>
Originally	O
,	O
only	O
static	B-Library
libraries	I-Library
existed	O
.	O
</s>
<s>
Static	B-Library
linking	I-Library
must	O
be	O
performed	O
when	O
any	O
modules	B-Architecture
are	O
recompiled	B-Language
.	O
</s>
<s>
All	O
of	O
the	O
modules	B-Architecture
required	O
by	O
a	O
program	O
are	O
sometimes	O
statically	O
linked	O
and	O
copied	O
into	O
the	O
executable	B-Application
file	I-Application
.	O
</s>
<s>
This	O
process	B-Operating_System
,	O
and	O
the	O
resulting	O
stand-alone	O
file	O
,	O
is	O
known	O
as	O
a	O
static	B-Application
build	I-Application
of	O
the	O
program	O
.	O
</s>
<s>
A	O
static	B-Application
build	I-Application
may	O
not	O
need	O
any	O
further	O
relocation	B-Library
if	O
virtual	B-Architecture
memory	I-Architecture
is	O
used	O
and	O
no	O
address	O
space	O
layout	O
randomization	O
is	O
desired	O
.	O
</s>
<s>
A	O
shared	O
library	O
or	O
shared	O
object	O
is	O
a	O
file	O
that	O
is	O
intended	O
to	O
be	O
shared	O
by	O
executable	B-Application
files	I-Application
and	O
further	O
shared	O
object	B-Application
files	I-Application
.	O
</s>
<s>
Modules	B-Architecture
used	O
by	O
a	O
program	O
are	O
loaded	B-Operating_System
from	O
individual	O
shared	O
objects	O
into	O
memory	O
at	O
load	B-Operating_System
time	I-Operating_System
or	O
runtime	B-Library
,	O
rather	O
than	O
being	O
copied	O
by	O
a	O
linker	B-Application
when	O
it	O
creates	O
a	O
single	O
monolithic	O
executable	B-Application
file	I-Application
for	O
the	O
program	O
.	O
</s>
<s>
Shared	O
libraries	O
can	O
be	O
statically	O
linked	O
during	O
compile-time	B-Application
,	O
meaning	O
that	O
references	O
to	O
the	O
library	O
modules	B-Architecture
are	O
resolved	O
and	O
the	O
modules	B-Architecture
are	O
allocated	O
memory	O
when	O
the	O
executable	B-Application
file	I-Application
is	O
created	O
.	O
</s>
<s>
But	O
often	O
linking	B-Application
of	O
shared	O
libraries	O
is	O
postponed	O
until	O
they	O
are	O
loaded	B-Operating_System
.	O
</s>
<s>
Most	O
modern	O
operating	B-General_Concept
systems	I-General_Concept
can	O
have	O
shared	O
library	O
files	O
of	O
the	O
same	O
format	O
as	O
the	O
executable	B-Application
files	I-Application
.	O
</s>
<s>
This	O
offers	O
two	O
main	O
advantages	O
:	O
first	O
,	O
it	O
requires	O
making	O
only	O
one	O
loader	B-Operating_System
for	O
both	O
of	O
them	O
,	O
rather	O
than	O
two	O
(	O
having	O
the	O
single	O
loader	B-Operating_System
is	O
considered	O
well	O
worth	O
its	O
added	O
complexity	O
)	O
.	O
</s>
<s>
Secondly	O
,	O
it	O
allows	O
the	O
executables	B-Application
also	O
to	O
be	O
used	O
as	O
shared	O
libraries	O
,	O
if	O
they	O
have	O
a	O
symbol	B-Application
table	I-Application
.	O
</s>
<s>
Typical	O
combined	O
executable	B-Application
and	O
shared	O
library	O
formats	O
are	O
ELF	O
and	O
Mach-O	B-Operating_System
(	O
both	O
in	O
Unix	B-Application
)	O
and	O
PE	O
(	O
Windows	B-Application
)	O
.	O
</s>
<s>
In	O
some	O
older	O
environments	O
such	O
as	O
16-bit	B-Library
Windows	I-Library
or	O
MPE	B-Operating_System
for	O
the	O
HP	B-Device
3000	I-Device
,	O
only	O
stack-based	O
data	O
(	O
local	O
)	O
was	O
allowed	O
in	O
shared-library	O
code	O
,	O
or	O
other	O
significant	O
restrictions	O
were	O
placed	O
on	O
shared-library	O
code	O
.	O
</s>
<s>
If	O
virtual	B-Architecture
memory	I-Architecture
is	O
used	O
,	O
processes	O
would	O
execute	O
the	O
same	O
physical	O
page	O
of	O
RAM	O
that	O
is	O
mapped	O
into	O
the	O
different	O
address	O
spaces	O
of	O
the	O
processes	O
.	O
</s>
<s>
For	O
instance	O
,	O
on	O
the	O
OpenStep	B-Operating_System
system	O
,	O
applications	O
were	O
often	O
only	O
a	O
few	O
hundred	O
kilobytes	O
in	O
size	O
and	O
loaded	B-Operating_System
quickly	O
;	O
most	O
of	O
their	O
code	O
was	O
located	O
in	O
libraries	O
that	O
had	O
already	O
been	O
loaded	B-Operating_System
for	O
other	O
purposes	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
Programs	O
can	O
accomplish	O
RAM	O
sharing	O
by	O
using	O
position-independent	B-Operating_System
code	I-Operating_System
,	O
as	O
in	O
Unix	B-Application
,	O
which	O
leads	O
to	O
a	O
complex	O
but	O
flexible	O
architecture	O
,	O
or	O
by	O
using	O
common	O
virtual	O
addresses	O
,	O
as	O
in	O
Windows	B-Application
and	O
OS/2	B-Application
.	O
</s>
<s>
A	O
third	O
alternative	O
is	O
single-level	B-Device
store	I-Device
,	O
as	O
used	O
by	O
the	O
IBM	B-Device
System/38	I-Device
and	O
its	O
successors	O
.	O
</s>
<s>
This	O
allows	O
position-dependent	B-Operating_System
code	I-Operating_System
,	O
but	O
places	O
no	O
significant	O
restrictions	O
on	O
where	O
code	O
can	O
be	O
placed	O
or	O
how	O
it	O
can	O
be	O
shared	O
.	O
</s>
<s>
Such	O
a	O
scenario	O
is	O
known	O
as	O
DLL	O
hell	O
,	O
named	O
after	O
the	O
Windows	B-Application
and	O
OS/2	B-Application
DLL	O
file	O
.	O
</s>
<s>
Most	O
modern	O
operating	B-General_Concept
systems	I-General_Concept
after	O
2001	O
have	O
clean-up	O
methods	B-Language
to	O
eliminate	O
such	O
situations	O
or	O
use	O
application-specific	O
"	O
private	O
"	O
libraries	O
.	O
</s>
<s>
Dynamic	B-Application
linking	I-Application
or	O
late	O
binding	O
is	O
linking	B-Application
performed	O
while	O
a	O
program	O
is	O
being	O
loaded	B-Operating_System
(	O
load	B-Operating_System
time	I-Operating_System
)	O
or	O
executed	O
(	O
runtime	B-Library
)	O
,	O
rather	O
than	O
when	O
the	O
executable	B-Application
file	I-Application
is	O
created	O
.	O
</s>
<s>
A	O
dynamically	O
linked	O
library	O
(	O
dynamic-link	O
library	O
,	O
or	O
DLL	O
,	O
under	O
Windows	B-Application
and	O
OS/2	B-Application
;	O
shareable	O
image	O
under	O
OpenVMS	B-Operating_System
;	O
dynamic	B-Application
shared	I-Application
object	I-Application
,	O
or	O
DSO	O
,	O
under	O
Unix-like	B-Operating_System
systems	I-Operating_System
)	O
is	O
a	O
library	O
intended	O
for	O
dynamic	B-Application
linking	I-Application
.	O
</s>
<s>
Only	O
a	O
minimal	O
amount	O
of	O
work	O
is	O
done	O
by	O
the	O
linker	B-Application
when	O
the	O
executable	B-Application
file	I-Application
is	O
created	O
;	O
it	O
only	O
records	O
what	O
library	O
routines	O
the	O
program	O
needs	O
and	O
the	O
index	O
names	O
or	O
numbers	O
of	O
the	O
routines	O
in	O
the	O
library	O
.	O
</s>
<s>
The	O
majority	O
of	O
the	O
work	O
of	O
linking	B-Application
is	O
done	O
at	O
the	O
time	O
the	O
application	O
is	O
loaded	B-Operating_System
(	O
load	B-Operating_System
time	I-Operating_System
)	O
or	O
during	O
execution	O
(	O
runtime	B-Library
)	O
.	O
</s>
<s>
Usually	O
,	O
the	O
necessary	O
linking	B-Application
program	O
,	O
called	O
a	O
"	O
dynamic	B-Application
linker	I-Application
"	O
or	O
"	O
linking	B-Application
loader	I-Application
"	O
,	O
is	O
actually	O
part	O
of	O
the	O
underlying	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
(	O
However	O
,	O
it	O
is	O
possible	O
,	O
and	O
not	O
exceedingly	O
difficult	O
,	O
to	O
write	O
a	O
program	O
that	O
uses	O
dynamic	B-Application
linking	I-Application
and	O
includes	O
its	O
own	O
dynamic	B-Application
linker	I-Application
,	O
even	O
for	O
an	O
operating	B-General_Concept
system	I-General_Concept
that	O
itself	O
provides	O
no	O
support	O
for	O
dynamic	B-Application
linking	I-Application
.	O
)	O
</s>
<s>
Programmers	O
originally	O
developed	O
dynamic	B-Application
linking	I-Application
in	O
the	O
Multics	B-Application
operating	I-Application
system	I-Application
,	O
starting	O
in	O
1964	O
,	O
and	O
the	O
MTS	O
(	O
Michigan	B-Application
Terminal	I-Application
System	I-Application
)	O
,	O
built	O
in	O
the	O
late	O
1960s	O
.	O
</s>
<s>
Since	O
shared	O
libraries	O
on	O
most	O
systems	O
do	O
not	O
change	O
often	O
,	O
systems	O
can	O
compute	O
a	O
likely	O
load	O
address	O
for	O
each	O
shared	O
library	O
on	O
the	O
system	O
before	O
it	O
is	O
needed	O
and	O
store	O
that	O
information	O
in	O
the	O
libraries	O
and	O
executables	B-Application
.	O
</s>
<s>
If	O
every	O
shared	O
library	O
that	O
is	O
loaded	B-Operating_System
has	O
undergone	O
this	O
process	B-Operating_System
,	O
then	O
each	O
will	O
load	O
at	O
its	O
predetermined	O
address	O
,	O
which	O
speeds	O
up	O
the	O
process	B-Operating_System
of	O
dynamic	B-Application
linking	I-Application
.	O
</s>
<s>
This	O
optimization	O
is	O
known	O
as	O
prebinding	B-Library
or	I-Library
prelinking	I-Library
on	O
macOS	O
and	O
Linux	O
,	O
respectively	O
.	O
</s>
<s>
IBM	O
z/VM	B-Application
uses	O
a	O
similar	O
technique	O
,	O
called	O
"	O
Discontinuous	O
Saved	O
Segments	O
"	O
(	O
DCSS	O
)	O
.	O
</s>
<s>
Disadvantages	O
of	O
this	O
technique	O
include	O
the	O
time	O
required	O
to	O
precompute	O
these	O
addresses	O
every	O
time	O
the	O
shared	O
libraries	O
change	O
,	O
the	O
inability	O
to	O
use	O
address	O
space	O
layout	O
randomization	O
,	O
and	O
the	O
requirement	O
of	O
sufficient	O
virtual	O
address	O
space	O
for	O
use	O
(	O
a	O
problem	O
that	O
will	O
be	O
alleviated	O
by	O
the	O
adoption	O
of	O
64-bit	B-Device
architectures	I-Device
,	O
at	O
least	O
for	O
the	O
time	O
being	O
)	O
.	O
</s>
<s>
Loaders	B-Operating_System
for	O
shared	O
libraries	O
vary	O
widely	O
in	O
functionality	O
.	O
</s>
<s>
Some	O
depend	O
on	O
the	O
executable	B-Application
storing	O
explicit	O
paths	O
to	O
the	O
libraries	O
.	O
</s>
<s>
More	O
commonly	O
,	O
only	O
the	O
name	O
of	O
the	O
library	O
(	O
and	O
not	O
the	O
path	O
)	O
is	O
stored	O
in	O
the	O
executable	B-Application
,	O
with	O
the	O
operating	B-General_Concept
system	I-General_Concept
supplying	O
a	O
method	O
to	O
find	O
the	O
library	O
on	O
disk	O
,	O
based	O
on	O
some	O
algorithm	O
.	O
</s>
<s>
If	O
a	O
shared	O
library	O
that	O
an	O
executable	B-Application
depends	O
on	O
is	O
deleted	O
,	O
moved	O
,	O
or	O
renamed	O
,	O
or	O
if	O
an	O
incompatible	O
version	O
of	O
the	O
library	O
is	O
copied	O
to	O
a	O
place	O
that	O
is	O
earlier	O
in	O
the	O
search	O
,	O
the	O
executable	B-Application
would	O
fail	O
to	O
load	O
.	O
</s>
<s>
This	O
is	O
called	O
dependency	B-Protocol
hell	I-Protocol
,	O
existing	O
on	O
many	O
platforms	O
.	O
</s>
<s>
The	O
(	O
infamous	O
)	O
Windows	B-Application
variant	O
is	O
commonly	O
known	O
as	O
DLL	O
hell	O
.	O
</s>
<s>
The	O
"	O
DLL	O
hell	O
"	O
problems	O
with	O
earlier	O
Windows	B-Application
versions	O
arose	O
from	O
using	O
only	O
the	O
names	O
of	O
libraries	O
,	O
which	O
were	O
not	O
guaranteed	O
to	O
be	O
unique	O
,	O
to	O
resolve	O
dynamic	O
links	O
in	O
programs	O
.	O
</s>
<s>
(	O
To	O
avoid	O
"	O
DLL	O
hell	O
"	O
,	O
later	O
versions	O
of	O
Windows	B-Application
rely	O
largely	O
on	O
options	O
for	O
programs	O
to	O
install	O
private	O
DLLsessentially	O
a	O
partial	O
retreat	O
from	O
the	O
use	O
of	O
shared	O
librariesalong	O
with	O
mechanisms	O
to	O
prevent	O
replacement	O
of	O
shared	O
system	O
DLLs	O
with	O
earlier	O
versions	O
of	O
them	O
.	O
)	O
</s>
<s>
Microsoft	B-Application
Windows	I-Application
checks	O
the	O
registry	B-Protocol
to	O
determine	O
the	O
proper	O
place	O
to	O
load	O
DLLs	O
that	O
implement	O
COM	B-Application
objects	I-Application
,	O
but	O
for	O
other	O
DLLs	O
it	O
will	O
check	O
the	O
directories	B-Application
in	O
a	O
defined	O
order	O
.	O
</s>
<s>
First	O
,	O
Windows	B-Application
checks	O
the	O
directory	B-Application
where	O
it	O
loaded	B-Operating_System
the	O
program	O
(	O
private	O
DLL	O
)	O
;	O
any	O
directories	B-Application
set	O
by	O
calling	O
the	O
SetDllDirectory( )	O
function	O
;	O
the	O
System32	O
,	O
System	O
,	O
and	O
Windows	B-Application
directories	B-Application
;	O
then	O
the	O
current	O
working	O
directory	B-Application
;	O
and	O
finally	O
the	O
directories	B-Application
specified	O
by	O
the	O
PATH	O
environment	O
variable	O
.	O
</s>
<s>
Applications	O
written	O
for	O
the	O
.NET	B-Application
Framework	I-Application
(	O
since	O
2002	O
)	O
,	O
also	O
check	O
the	O
Global	O
Assembly	O
Cache	O
as	O
the	O
primary	O
store	O
of	O
shared	O
dll	O
files	O
to	O
remove	O
the	O
issue	O
of	O
DLL	O
hell	O
.	O
</s>
<s>
OpenStep	B-Operating_System
used	O
a	O
more	O
flexible	O
system	O
,	O
collecting	O
a	O
list	O
of	O
libraries	O
from	O
a	O
number	O
of	O
known	O
locations	O
(	O
similar	O
to	O
the	O
PATH	O
concept	O
)	O
when	O
the	O
system	O
first	O
starts	O
.	O
</s>
<s>
Most	O
Unix-like	B-Operating_System
systems	I-Operating_System
have	O
a	O
"	O
search	O
path	O
"	O
specifying	O
file-system	O
directories	B-Application
in	O
which	O
to	O
look	O
for	O
dynamic	B-Application
libraries	I-Application
.	O
</s>
<s>
Some	O
systems	O
specify	O
the	O
default	O
path	O
in	O
a	O
configuration	B-Protocol
file	I-Protocol
,	O
others	O
hard-code	O
it	O
into	O
the	O
dynamic	O
loader	B-Operating_System
.	O
</s>
<s>
Some	O
executable	B-Application
file	I-Application
formats	I-Application
can	O
specify	O
additional	O
directories	B-Application
in	O
which	O
to	O
search	O
for	O
libraries	O
for	O
a	O
particular	O
program	O
.	O
</s>
<s>
Developers	O
of	O
libraries	O
are	O
encouraged	O
to	O
place	O
their	O
dynamic	B-Application
libraries	I-Application
in	O
places	O
in	O
the	O
default	O
search	O
path	O
.	O
</s>
<s>
Dynamic	B-Operating_System
loading	I-Operating_System
,	O
a	O
subset	O
of	O
dynamic	B-Application
linking	I-Application
,	O
involves	O
a	O
dynamically	O
linked	O
library	O
loading	O
and	O
unloading	O
at	B-Library
runtime	I-Library
on	O
request	O
.	O
</s>
<s>
Implicit	O
requests	O
are	O
made	O
when	O
a	O
compiler	B-Language
or	O
static	O
linker	B-Application
adds	O
library	O
references	O
that	O
include	O
file	O
paths	O
or	O
simply	O
file	O
names	O
.	O
</s>
<s>
Explicit	O
requests	O
are	O
made	O
when	O
applications	O
make	O
direct	O
calls	O
to	O
an	O
operating	B-General_Concept
system	I-General_Concept
's	O
API	B-Application
.	O
</s>
<s>
Most	O
operating	B-General_Concept
systems	I-General_Concept
that	O
support	O
dynamically	O
linked	O
libraries	O
also	O
support	O
dynamically	O
loading	O
such	O
libraries	O
via	O
a	O
run-time	B-Library
linker	B-Application
API	B-Application
.	O
</s>
<s>
For	O
instance	O
,	O
Microsoft	B-Application
Windows	I-Application
uses	O
the	O
API	B-Application
functions	I-Application
LoadLibrary	O
,	O
LoadLibraryEx	O
,	O
FreeLibrary	O
and	O
GetProcAddress	O
with	O
Microsoft	O
Dynamic	O
Link	O
Libraries	O
;	O
POSIX-based	O
systems	O
,	O
including	O
most	O
UNIX	B-Application
and	O
UNIX-like	B-Operating_System
systems	I-Operating_System
,	O
use	O
dlopen	B-Operating_System
,	O
dlclose	O
and	O
dlsym	O
.	O
</s>
<s>
Some	O
development	O
systems	O
automate	O
this	O
process	B-Operating_System
.	O
</s>
<s>
Although	O
originally	O
pioneered	O
in	O
the	O
1960s	O
,	O
dynamic	B-Application
linking	I-Application
did	O
not	O
reach	O
operating	B-General_Concept
systems	I-General_Concept
used	O
by	O
consumers	O
until	O
the	O
late	O
1980s	O
.	O
</s>
<s>
It	O
was	O
generally	O
available	O
in	O
some	O
form	O
in	O
most	O
operating	B-General_Concept
systems	I-General_Concept
by	O
the	O
early	O
1990s	O
.	O
</s>
<s>
During	O
this	O
same	O
period	O
,	O
object-oriented	B-Language
programming	I-Language
(	O
OOP	O
)	O
was	O
becoming	O
a	O
significant	O
part	O
of	O
the	O
programming	O
landscape	O
.	O
</s>
<s>
OOP	O
with	O
runtime	B-Library
binding	O
requires	O
additional	O
information	O
that	O
traditional	O
libraries	O
do	O
n't	O
supply	O
.	O
</s>
<s>
This	O
is	O
more	O
than	O
simply	O
listing	O
that	O
one	O
library	O
requires	O
the	O
services	O
of	O
another	O
:	O
in	O
a	O
true	O
OOP	O
system	O
,	O
the	O
libraries	O
themselves	O
may	O
not	O
be	O
known	O
at	O
compile	B-Application
time	I-Application
,	O
and	O
vary	O
from	O
system	O
to	O
system	O
.	O
</s>
<s>
At	O
the	O
same	O
time	O
many	O
developers	O
worked	O
on	O
the	O
idea	O
of	O
multi-tier	O
programs	O
,	O
in	O
which	O
a	O
"	O
display	O
"	O
running	O
on	O
a	O
desktop	O
computer	O
would	O
use	O
the	O
services	O
of	O
a	O
mainframe	B-Architecture
or	O
minicomputer	B-Architecture
for	O
data	O
storage	O
or	O
processing	O
.	O
</s>
<s>
For	O
instance	O
,	O
a	O
program	O
on	O
a	O
GUI-based	O
computer	O
would	O
send	O
messages	O
to	O
a	O
minicomputer	B-Architecture
to	O
return	O
small	O
samples	O
of	O
a	O
huge	O
dataset	O
for	O
display	O
.	O
</s>
<s>
Remote	B-Operating_System
procedure	I-Operating_System
calls	I-Operating_System
(	O
RPC	O
)	O
already	O
handled	O
these	O
tasks	O
,	O
but	O
there	O
was	O
no	O
standard	O
RPC	O
system	O
.	O
</s>
<s>
Soon	O
the	O
majority	O
of	O
the	O
minicomputer	B-Architecture
and	O
mainframe	B-Architecture
vendors	O
instigated	O
projects	O
to	O
combine	O
the	O
two	O
,	O
producing	O
an	O
OOP	O
library	O
format	O
that	O
could	O
be	O
used	O
anywhere	O
.	O
</s>
<s>
Examples	O
include	O
IBM	O
's	O
System	B-Application
Object	I-Application
Model	I-Application
(	O
SOM/DSOM	O
)	O
,	O
Sun	O
Microsystems	O
 '	O
Distributed	B-Application
Objects	I-Application
Everywhere	I-Application
(	O
DOE	O
)	O
,	O
NeXT	O
's	O
Portable	B-Application
Distributed	I-Application
Objects	I-Application
(	O
PDO	O
)	O
,	O
Digital	O
's	O
ObjectBroker	O
,	O
Microsoft	O
's	O
Component	B-Application
Object	I-Application
Model	I-Application
(	O
COM/DCOM	O
)	O
,	O
and	O
any	O
number	O
of	O
CORBA-based	O
systems	O
.	O
</s>
<s>
Class	B-Application
libraries	I-Application
are	O
the	O
rough	O
OOP	O
equivalent	O
of	O
older	O
types	O
of	O
code	O
libraries	O
.	O
</s>
<s>
They	O
contain	O
classes	O
,	O
which	O
describe	O
characteristics	O
and	O
define	O
actions	O
(	O
methods	B-Language
)	O
that	O
involve	O
objects	O
.	O
</s>
<s>
Class	B-Application
libraries	I-Application
are	O
used	O
to	O
create	O
instances	O
,	O
or	O
objects	O
with	O
their	O
characteristics	O
set	O
to	O
specific	O
values	O
.	O
</s>
<s>
In	O
some	O
OOP	O
languages	O
,	O
like	O
Java	B-Language
,	O
the	O
distinction	O
is	O
clear	O
,	O
with	O
the	O
classes	O
often	O
contained	O
in	O
library	O
files	O
(	O
like	O
Java	B-Language
's	O
JAR	B-Language
file	I-Language
format	I-Language
)	O
and	O
the	O
instantiated	O
objects	O
residing	O
only	O
in	O
memory	O
(	O
although	O
potentially	O
able	O
to	O
be	O
made	O
persistent	B-Application
in	O
separate	O
files	O
)	O
.	O
</s>
<s>
In	O
others	O
,	O
like	O
Smalltalk	B-Application
,	O
the	O
class	B-Application
libraries	I-Application
are	O
merely	O
the	O
starting	O
point	O
for	O
a	O
system	B-Operating_System
image	I-Operating_System
that	O
includes	O
the	O
entire	O
state	O
of	O
the	O
environment	O
,	O
classes	O
and	O
all	O
instantiated	O
objects	O
.	O
</s>
<s>
Today	O
most	O
class	B-Application
libraries	I-Application
are	O
stored	O
in	O
a	O
package	B-Application
repository	I-Application
(	O
such	O
as	O
Maven	O
Central	O
for	O
Java	B-Language
)	O
.	O
</s>
<s>
Client	O
code	O
explicitly	O
declare	O
the	O
dependencies	O
to	O
external	O
libraries	O
in	O
build	O
configuration	B-Protocol
files	I-Protocol
(	O
such	O
as	O
a	O
Maven	O
Pom	O
in	O
Java	B-Language
)	O
.	O
</s>
<s>
Another	O
library	O
technique	O
uses	O
completely	O
separate	O
executables	B-Application
(	O
often	O
in	O
some	O
lightweight	O
form	O
)	O
and	O
calls	O
them	O
using	O
a	O
remote	B-Operating_System
procedure	I-Operating_System
call	I-Operating_System
(	O
RPC	O
)	O
over	O
a	O
network	O
to	O
another	O
computer	O
.	O
</s>
<s>
This	O
maximizes	O
operating	B-General_Concept
system	I-General_Concept
re-use	O
:	O
the	O
code	O
needed	O
to	O
support	O
the	O
library	O
is	O
the	O
same	O
code	O
being	O
used	O
to	O
provide	O
application	O
support	O
and	O
security	O
for	O
every	O
other	O
program	O
.	O
</s>
<s>
RPC	O
calls	O
are	O
much	O
more	O
expensive	O
than	O
calling	O
a	O
shared	O
library	O
that	O
has	O
already	O
been	O
loaded	B-Operating_System
on	O
the	O
same	O
machine	O
.	O
</s>
<s>
This	O
approach	O
is	O
commonly	O
used	O
in	O
a	O
distributed	B-Architecture
architecture	I-Architecture
that	O
makes	O
heavy	O
use	O
of	O
such	O
remote	O
calls	O
,	O
notably	O
client-server	O
systems	O
and	O
application	B-Application
servers	I-Application
such	O
as	O
Enterprise	B-Language
JavaBeans	I-Language
.	O
</s>
<s>
Code	O
generation	O
libraries	O
are	O
high-level	O
APIs	B-Application
that	O
can	O
generate	O
or	O
transform	O
byte	O
code	O
for	O
Java	B-Language
.	O
</s>
<s>
They	O
are	O
used	O
by	O
aspect-oriented	B-Architecture
programming	I-Architecture
,	O
some	O
data	O
access	O
frameworks	O
,	O
and	O
for	O
testing	O
to	O
generate	O
dynamic	O
proxy	O
objects	O
.	O
</s>
<s>
The	O
system	O
stores	O
libfoo.a	O
and	O
libfoo.so	O
files	O
in	O
directories	B-Application
such	O
as	O
/lib	O
,	O
/usr/lib	O
or	O
/usr/local/lib	O
.	O
</s>
<s>
The	O
filenames	O
always	O
start	O
with	O
lib	O
,	O
and	O
end	O
with	O
a	O
suffix	O
of	O
.a	B-Library
(	O
archive	B-Application
,	O
static	B-Library
library	I-Library
)	O
or	O
of	O
.so	O
(	O
shared	O
object	O
,	O
dynamically	O
linked	O
library	O
)	O
.	O
</s>
<s>
Most	O
of	O
the	O
names	O
are	O
names	O
for	O
symbolic	B-Application
links	I-Application
to	O
the	O
latest	O
version	O
.	O
</s>
<s>
For	O
example	O
,	O
on	O
some	O
systems	O
libfoo.so.2	O
would	O
be	O
the	O
filename	O
for	O
the	O
second	O
major	O
interface	B-Application
revision	O
of	O
the	O
dynamically	O
linked	O
library	O
libfoo	O
.	O
</s>
<s>
The	O
.la	O
files	O
sometimes	O
found	O
in	O
the	O
library	O
directories	B-Application
are	O
libtool	B-Application
archives	O
,	O
not	O
usable	O
by	O
the	O
system	O
as	O
such	O
.	O
</s>
<s>
The	O
system	O
inherits	O
static	B-Library
library	I-Library
conventions	O
from	O
BSD	B-Operating_System
,	O
with	O
the	O
library	O
stored	O
in	O
a	O
.a	B-Library
file	O
,	O
and	O
can	O
use	O
.so-style	O
dynamically	O
linked	O
libraries	O
(	O
with	O
the	O
.dylib	O
suffix	O
instead	O
)	O
.	O
</s>
<s>
Most	O
libraries	O
in	O
macOS	O
,	O
however	O
,	O
consist	O
of	O
"	O
frameworks	O
"	O
,	O
placed	O
inside	O
special	O
directories	B-Application
called	O
"	O
bundles	B-Application
"	O
which	O
wrap	O
the	O
library	O
's	O
required	O
files	O
and	O
metadata	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
framework	O
called	O
MyFramework	O
would	O
be	O
implemented	O
in	O
a	O
bundle	B-Application
called	O
MyFramework.framework	O
,	O
with	O
MyFramework.framework/MyFramework	O
being	O
either	O
the	O
dynamically	O
linked	O
library	O
file	O
or	O
being	O
a	O
symlink	B-Application
to	O
the	O
dynamically	O
linked	O
library	O
file	O
in	O
MyFramework.framework/Versions/Current/MyFramework	O
.	O
</s>
<s>
*	O
.OCX	B-Operating_System
for	O
OLE	B-Operating_System
libraries	O
.	O
</s>
<s>
The	O
interface	B-Application
revisions	O
are	O
either	O
encoded	O
in	O
the	O
file	O
names	O
,	O
or	O
abstracted	O
away	O
using	O
COM-object	B-Application
interfaces	B-Application
.	O
</s>
<s>
Depending	O
on	O
how	O
they	O
are	O
compiled	B-Language
,	O
*	O
.LIB	B-Library
files	O
can	O
be	O
either	O
static	B-Library
libraries	I-Library
or	O
representations	O
of	O
dynamically	O
linkable	O
libraries	O
needed	O
only	O
during	O
compilation	B-Language
,	O
known	O
as	O
"	O
import	O
libraries	O
"	O
.	O
</s>
<s>
Unlike	O
in	O
the	O
UNIX	B-Application
world	O
,	O
which	O
uses	O
different	O
file	O
extensions	O
,	O
when	O
linking	B-Application
against	O
.LIB	B-Library
file	O
in	O
Windows	B-Application
one	O
must	O
first	O
know	O
if	O
it	O
is	O
a	O
regular	O
static	B-Library
library	I-Library
or	O
an	O
import	O
library	O
.	O
</s>
<s>
In	O
the	O
latter	O
case	O
,	O
a	O
.DLL	O
file	O
must	O
be	O
present	O
at	B-Library
runtime	I-Library
.	O
</s>
