<s>
In	O
computing	O
,	O
a	O
dynamic	B-Application
linker	I-Application
is	O
the	O
part	O
of	O
an	O
operating	B-General_Concept
system	I-General_Concept
that	O
loads	B-Operating_System
and	O
links	B-Application
the	O
shared	O
libraries	O
needed	O
by	O
an	O
executable	B-Application
when	O
it	O
is	O
executed	O
(	O
at	O
"	O
run	B-Library
time	I-Library
"	O
)	O
,	O
by	O
copying	O
the	O
content	O
of	O
libraries	O
from	O
persistent	B-Application
storage	I-Application
to	O
RAM	B-Architecture
,	O
filling	O
jump	O
tables	O
and	O
relocating	O
pointers	O
.	O
</s>
<s>
The	O
specific	O
operating	B-General_Concept
system	I-General_Concept
and	O
executable	B-Application
format	O
determine	O
how	O
the	O
dynamic	B-Application
linker	I-Application
functions	O
and	O
how	O
it	O
is	O
implemented	O
.	O
</s>
<s>
Linking	B-Application
is	O
often	O
referred	O
to	O
as	O
a	O
process	B-Operating_System
that	O
is	O
performed	O
when	O
the	O
executable	B-Application
is	O
compiled	B-Application
,	O
while	O
a	O
dynamic	B-Application
linker	I-Application
is	O
a	O
special	O
part	O
of	O
an	O
operating	B-General_Concept
system	I-General_Concept
that	O
loads	B-Operating_System
external	O
shared	O
libraries	O
into	O
a	O
running	O
process	B-Operating_System
and	O
then	O
binds	O
those	O
shared	O
libraries	O
dynamically	O
to	O
the	O
running	O
process	B-Operating_System
.	O
</s>
<s>
This	O
approach	O
is	O
also	O
called	O
dynamic	B-Application
linking	I-Application
or	O
late	B-Application
linking	I-Application
.	O
</s>
<s>
Dynamic-link	O
library	O
,	O
or	O
DLL	O
,	O
is	O
Microsoft	O
's	O
implementation	O
of	O
the	O
shared	O
library	O
concept	O
in	O
the	O
Microsoft	B-Application
Windows	I-Application
and	O
OS/2	B-Application
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
These	O
libraries	O
usually	O
have	O
the	O
file	O
extension	O
DLL	O
,	O
OCX	O
(	O
for	O
libraries	O
containing	O
ActiveX	B-Application
controls	I-Application
)	O
,	O
or	O
DRV	O
(	O
for	O
legacy	O
system	B-Application
drivers	I-Application
)	O
.	O
</s>
<s>
The	O
file	O
formats	O
for	O
DLLs	O
are	O
the	O
same	O
as	O
for	O
Windows	O
EXE	O
files	B-Operating_System
that	O
is	O
,	O
Portable	O
Executable	B-Application
(	O
PE	O
)	O
for	O
32-bit	O
and	O
64-bit	B-Device
Windows	O
,	O
and	O
New	O
Executable	B-Application
(	O
NE	O
)	O
for	O
16-bit	B-Device
Windows	O
.	O
</s>
<s>
As	O
with	O
EXEs	O
,	O
DLLs	O
can	O
contain	O
code	B-Language
,	O
data	B-General_Concept
,	O
and	O
resources	O
,	O
in	O
any	O
combination	O
.	O
</s>
<s>
Data	B-General_Concept
files	B-Operating_System
with	O
the	O
same	O
file	O
format	O
as	O
a	O
DLL	O
,	O
but	O
with	O
different	O
file	O
extensions	O
and	O
possibly	O
containing	O
only	O
resource	O
sections	O
,	O
can	O
be	O
called	O
resource	O
DLLs	O
.	O
</s>
<s>
Examples	O
of	O
such	O
DLLs	O
include	O
multi-language	O
user	O
interface	O
libraries	O
with	O
extension	O
MUI	O
,	O
icon	O
libraries	O
,	O
sometimes	O
having	O
the	O
extension	O
ICL	O
,	O
and	O
font	O
files	B-Operating_System
,	O
having	O
the	O
extensions	O
FON	O
and	O
FOT	O
.	O
</s>
<s>
In	O
most	O
Unix-like	B-Operating_System
systems	I-Operating_System
,	O
most	O
of	O
the	O
machine	B-Language
code	I-Language
that	O
makes	O
up	O
the	O
dynamic	B-Application
linker	I-Application
is	O
actually	O
an	O
external	O
executable	B-Application
that	O
the	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
loads	B-Operating_System
and	O
executes	O
first	O
in	O
a	O
process	B-Operating_System
address	O
space	O
newly	O
constructed	O
as	O
a	O
result	O
of	O
calling	O
exec	B-Operating_System
or	O
posix_spawn	O
functions	O
.	O
</s>
<s>
At	O
link	O
time	O
,	O
the	O
path	O
of	O
the	O
dynamic	B-Application
linker	I-Application
that	O
should	O
be	O
used	O
is	O
embedded	O
into	O
the	O
executable	B-Application
image	O
.	O
</s>
<s>
When	O
an	O
executable	B-Application
file	I-Application
is	O
loaded	O
,	O
the	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
reads	O
the	O
path	O
of	O
the	O
dynamic	B-Application
linker	I-Application
from	O
it	O
and	O
then	O
attempts	O
to	O
load	O
and	O
execute	O
this	O
other	O
executable	B-Application
binary	I-Application
;	O
if	O
that	O
attempt	O
fails	O
because	O
,	O
for	O
example	O
,	O
there	O
is	O
no	O
file	O
with	O
that	O
path	O
,	O
the	O
attempt	O
to	O
execute	O
the	O
original	O
executable	B-Application
fails	O
.	O
</s>
<s>
The	O
dynamic	B-Application
linker	I-Application
then	O
loads	B-Operating_System
the	O
initial	O
executable	B-Application
image	O
and	O
all	O
the	O
dynamically-linked	O
libraries	O
on	O
which	O
it	O
depends	O
and	O
starts	O
the	O
executable	B-Application
.	O
</s>
<s>
As	O
a	O
result	O
,	O
the	O
pathname	O
of	O
the	O
dynamic	B-Application
linker	I-Application
is	O
part	O
of	O
the	O
operating	B-General_Concept
system	I-General_Concept
's	O
application	B-Operating_System
binary	I-Operating_System
interface	I-Operating_System
.	O
</s>
<s>
In	O
Unix-like	B-Operating_System
systems	I-Operating_System
that	O
use	O
ELF	O
for	O
executable	B-Application
images	O
and	O
dynamic	B-Application
libraries	I-Application
,	O
such	O
as	O
Solaris	B-Application
,	O
64-bit	B-Device
versions	O
of	O
HP-UX	B-Application
,	O
Linux	B-Application
,	O
FreeBSD	B-Operating_System
,	O
NetBSD	B-Device
,	O
OpenBSD	B-Operating_System
,	O
and	O
DragonFly	B-Application
BSD	I-Application
,	O
the	O
path	O
of	O
the	O
dynamic	B-Application
linker	I-Application
that	O
should	O
be	O
used	O
is	O
embedded	O
at	O
link	O
time	O
into	O
the	O
.interp	O
section	O
of	O
the	O
executable	B-Application
's	O
PT_INTERP	O
segment	O
.	O
</s>
<s>
The	O
dynamic	B-Application
linker	I-Application
can	O
be	O
influenced	O
into	O
modifying	O
its	O
behavior	O
during	O
either	O
the	O
program	O
's	O
execution	O
or	O
the	O
program	O
's	O
linking	B-Application
,	O
and	O
the	O
examples	O
of	O
this	O
can	O
be	O
seen	O
in	O
the	O
run-time	O
linker	B-Application
manual	O
pages	O
for	O
various	O
Unix-like	B-Operating_System
systems	I-Operating_System
.	O
</s>
<s>
A	O
typical	O
modification	O
of	O
this	O
behavior	O
is	O
the	O
use	O
of	O
LD_LIBRARY_PATH	O
and	O
LD_PRELOAD	O
environment	O
variables	O
,	O
which	O
adjust	O
the	O
runtime	B-Library
linking	B-Application
process	B-Operating_System
by	O
searching	O
for	O
shared	O
libraries	O
at	O
alternate	O
locations	O
and	O
by	O
forcibly	O
loading	O
and	O
linking	B-Application
libraries	O
that	O
would	O
otherwise	O
not	O
be	O
,	O
respectively	O
.	O
</s>
<s>
An	O
example	O
is	O
zlibc	O
,	O
also	O
known	O
as	O
uncompress.so,	O
which	O
facilitates	O
transparent	O
decompression	O
when	O
used	O
through	O
the	O
LD_PRELOAD	O
hack	O
;	O
consequently	O
,	O
it	O
is	O
possible	O
to	O
read	O
pre-compressed	O
(	O
gzipped	O
)	O
file	O
data	B-General_Concept
on	O
BSD	O
and	O
Linux	B-Application
systems	O
as	O
if	O
the	O
files	B-Operating_System
were	O
not	O
compressed	O
,	O
essentially	O
allowing	O
a	O
user	O
to	O
add	O
transparent	O
compression	O
to	O
the	O
underlying	O
filesystem	O
,	O
although	O
with	O
some	O
caveats	O
.	O
</s>
<s>
The	O
mechanism	O
is	O
flexible	O
,	O
allowing	O
trivial	O
adaptation	O
of	O
the	O
same	O
code	B-Language
to	O
perform	O
additional	O
or	O
alternate	O
processing	O
of	O
data	B-General_Concept
during	O
the	O
file	O
read	O
,	O
prior	O
to	O
the	O
provision	O
of	O
said	O
data	B-General_Concept
to	O
the	O
user	O
process	B-Operating_System
that	O
has	O
requested	O
it	O
.	O
</s>
<s>
In	O
the	O
Apple	B-Operating_System
Darwin	I-Operating_System
operating	B-General_Concept
system	I-General_Concept
,	O
and	O
in	O
the	O
macOS	B-Application
and	O
iOS	B-Operating_System
operating	B-General_Concept
systems	I-General_Concept
built	O
on	O
top	O
of	O
it	O
,	O
the	O
path	O
of	O
the	O
dynamic	B-Application
linker	I-Application
that	O
should	O
be	O
used	O
is	O
embedded	O
at	O
link	O
time	O
into	O
one	O
of	O
the	O
Mach-O	B-Operating_System
load	O
commands	O
in	O
the	O
executable	B-Application
image	O
.	O
</s>
<s>
In	O
those	O
systems	O
,	O
dynamically	O
loaded	O
shared	O
libraries	O
can	O
be	O
identified	O
either	O
by	O
the	O
filename	O
suffix	O
.dylib	O
or	O
by	O
their	O
placement	O
inside	O
the	O
bundle	B-Application
for	O
a	O
framework	O
.	O
</s>
<s>
The	O
dynamic	B-Application
linker	I-Application
not	O
only	O
links	B-Application
the	O
target	O
executable	B-Application
to	O
the	O
shared	O
libraries	O
but	O
also	O
places	O
machine	B-Language
code	I-Language
functions	O
at	O
specific	O
address	O
points	O
in	O
memory	O
that	O
the	O
target	O
executable	B-Application
knows	O
about	O
at	O
link	O
time	O
.	O
</s>
<s>
When	O
an	O
executable	B-Application
wishes	O
to	O
interact	O
with	O
the	O
dynamic	B-Application
linker	I-Application
,	O
it	O
simply	O
executes	O
the	O
machine-specific	O
call	O
or	O
jump	O
instruction	O
to	O
one	O
of	O
those	O
well-known	O
address	O
points	O
.	O
</s>
<s>
The	O
executables	B-Application
on	O
the	O
macOS	B-Application
and	O
iOS	B-Operating_System
platforms	O
often	O
interact	O
with	O
the	O
dynamic	B-Application
linker	I-Application
during	O
the	O
execution	O
of	O
the	O
process	B-Operating_System
;	O
it	O
is	O
even	O
known	O
that	O
an	O
executable	B-Application
might	O
interact	O
with	O
the	O
dynamic	B-Application
linker	I-Application
,	O
causing	O
it	O
to	O
load	O
more	O
libraries	O
and	O
resolve	O
more	O
symbols	O
,	O
hours	O
after	O
it	O
initially	O
launches	O
.	O
</s>
<s>
The	O
reason	O
that	O
a	O
macOS	B-Application
or	O
iOS	B-Operating_System
program	O
interacts	O
with	O
the	O
dynamic	B-Application
linker	I-Application
so	O
often	O
is	O
due	O
both	O
to	O
Apple	O
's	O
Cocoa	B-Operating_System
and	O
Cocoa	B-Operating_System
Touch	I-Operating_System
APIs	O
and	O
Objective-C	B-Language
,	O
the	O
language	O
in	O
which	O
they	O
are	O
implemented	O
(	O
see	O
their	O
main	O
articles	O
for	O
more	O
information	O
)	O
.	O
</s>
<s>
The	O
dynamic	B-Application
linker	I-Application
can	O
be	O
coerced	O
into	O
modifying	O
some	O
of	O
its	O
behavior	O
;	O
however	O
,	O
unlike	O
other	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
,	O
these	O
modifications	O
are	O
hints	O
that	O
can	O
be	O
(	O
and	O
sometimes	O
are	O
)	O
ignored	O
by	O
the	O
dynamic	B-Application
linker	I-Application
.	O
</s>
<s>
Examples	O
of	O
this	O
can	O
be	O
seen	O
in	O
dyld	B-Application
's	O
manual	O
page	O
.	O
</s>
<s>
The	O
former	O
of	O
the	O
previously-mentioned	O
variables	O
adjusts	O
the	O
executables	B-Application
 '	O
search	O
path	O
for	O
the	O
shared	O
libraries	O
,	O
while	O
the	O
latter	O
displays	O
the	O
names	O
of	O
the	O
libraries	O
as	O
they	O
are	O
loaded	O
and	O
linked	O
.	O
</s>
<s>
Apple	O
's	O
macOS	B-Application
dynamic	B-Application
linker	I-Application
is	O
an	O
open-source	O
project	O
released	O
as	O
part	O
of	O
Darwin	B-Operating_System
and	O
can	O
be	O
found	O
in	O
the	O
Apple	O
's	O
open-source	O
dyld	B-Application
project	O
.	O
</s>
<s>
In	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
using	O
XCOFF	B-Operating_System
,	O
such	O
as	O
AIX	B-Application
,	O
dynamically-loaded	O
shared	O
libraries	O
use	O
the	O
filename	O
suffix	O
.a	O
.	O
</s>
<s>
The	O
dynamic	B-Application
linker	I-Application
can	O
be	O
influenced	O
into	O
modifying	O
its	O
behavior	O
during	O
either	O
the	O
program	O
's	O
execution	O
or	O
the	O
program	O
's	O
linking	B-Application
.	O
</s>
<s>
A	O
typical	O
modification	O
of	O
this	O
behavior	O
is	O
the	O
use	O
of	O
the	O
LIBPATH	B-Device
environment	O
variable	O
.	O
</s>
<s>
This	O
variable	O
adjusts	O
the	O
runtime	B-Library
linking	B-Application
process	B-Operating_System
by	O
searching	O
for	O
shared	O
libraries	O
at	O
alternate	O
locations	O
and	O
by	O
forcibly	O
loading	O
and	O
linking	B-Application
libraries	O
that	O
would	O
otherwise	O
not	O
be	O
,	O
respectively	O
.	O
</s>
<s>
Dynamic	B-Application
linking	I-Application
from	O
Assembler	O
language	O
programs	O
in	O
IBM	B-Application
OS/360	I-Application
and	I-Application
its	I-Application
successors	I-Application
is	O
done	O
typically	O
using	O
a	O
LINK	O
macro	O
instruction	O
containing	O
a	O
Supervisor	B-Operating_System
Call	I-Operating_System
instruction	I-Operating_System
that	O
activates	O
the	O
operating	B-General_Concept
system	I-General_Concept
routines	O
that	O
makes	O
the	O
library	O
module	O
to	O
be	O
linked	O
available	O
to	O
the	O
program	O
.	O
</s>
<s>
In	O
the	O
Multics	B-Application
operating	I-Application
system	I-Application
all	O
files	B-Operating_System
,	O
including	O
executables	B-Application
,	O
are	O
segments	B-General_Concept
.	O
</s>
<s>
A	O
call	O
to	O
a	O
routine	O
not	O
part	O
of	O
the	O
current	O
segment	O
will	O
cause	O
the	O
system	O
to	O
find	O
the	O
referenced	O
segment	O
,	O
in	O
memory	O
or	O
on	O
disk	O
,	O
and	O
add	O
it	O
to	O
the	O
address	O
space	O
of	O
the	O
running	O
process	B-Operating_System
.	O
</s>
<s>
Dynamic	B-Application
linking	I-Application
is	O
the	O
normal	O
method	O
of	O
operation	O
,	O
and	O
static	O
linking	B-Application
(	O
using	O
the	O
binder	O
)	O
is	O
the	O
exception	O
.	O
</s>
<s>
Dynamic	B-Application
linking	I-Application
is	O
generally	O
slower	O
(	O
requires	O
more	O
CPU	O
cycles	O
)	O
than	O
linking	B-Application
during	O
compilation	O
time	O
,	O
as	O
is	O
the	O
case	O
for	O
most	O
processes	O
executed	O
at	B-Library
runtime	I-Library
.	O
</s>
<s>
However	O
,	O
dynamic	B-Application
linking	I-Application
is	O
often	O
more	O
space-efficient	O
(	O
on	O
disk	O
and	O
in	O
memory	O
at	B-Library
runtime	I-Library
)	O
.	O
</s>
<s>
When	O
a	O
library	O
is	O
linked	O
statically	O
,	O
every	O
process	B-Operating_System
being	O
run	O
is	O
linked	O
with	O
its	O
own	O
copy	O
of	O
the	O
library	O
functions	O
being	O
called	O
upon	O
.	O
</s>
<s>
Using	O
shared	O
,	O
dynamic	B-Application
libraries	I-Application
means	O
that	O
,	O
instead	O
of	O
linking	B-Application
each	O
file	O
to	O
its	O
own	O
copy	O
of	O
a	O
library	O
at	O
compilation	O
time	O
and	O
potentially	O
wasting	O
memory	O
space	O
,	O
only	O
one	O
copy	O
of	O
the	O
library	O
is	O
ever	O
stored	O
in	O
memory	O
at	O
a	O
time	O
,	O
freeing	O
up	O
memory	O
space	O
to	O
be	O
used	O
elsewhere	O
.	O
</s>
<s>
Additionally	O
,	O
in	O
dynamic	B-Application
linking	I-Application
,	O
a	O
library	O
is	O
only	O
loaded	O
if	O
it	O
is	O
actually	O
being	O
used	O
.	O
</s>
