首页 > 代码库 > Shared libraries

Shared libraries

Computer Systems A Programmer‘s Perspective Second Edition

 

Shared libraries
are modern innovations that address the disadvantages of
static libraries. A shared library is an object module that,
at run time
, can be
loaded at an arbitrary memory address and linked with a program in memory.
This process is known as
dynamic linking
and is performed by a program called a
dynamic linker
.
Shared libraries are also referred to as
shared objects
, and on Unix systems
are typically denoted by the
.so
suffix. Microsoft operating systems make heavy
use of shared libraries, which they refer to as DLLs (dynamic link libraries).
Shared libraries are “shared” in two different ways. First, in any given file
system, there is exactly one
.so
file for a particular library. The code and data in
this
.so
file are shared by all of the executable object files that reference the library,
as opposed to the contents of static libraries, which are copied and embedded in
the executables that reference them. Second, a single copy of the
.text
section of
a shared library in memory can be shared by different running processes. We will
explore this in more detail when we study virtual memory in Chapter 9.
 

Shared libraries