They are called shared libraries because the code
they contain is not linked into programs when the programs are compiled. Rather, the
dynamic linker/loader links shared library code into programs at runtime.
Shared libraries have several advantages over static libraries. First, they require fewer system resources.
They use less disk space because shared library code is not compiled into each binary but linked
and loaded from a single location dynamically at runtime. They use less system memory because
the kernel shares the memory the library occupies among all the programs that use the library.
Second, shared libraries are slightly faster because they need to be loaded into memory only once.
Finally, shared libraries simplify code and system maintenance. As bugs are fixed or features added,
users need only obtain the updated library and install it. With static libraries, each program that
uses the library must be recompiled.
There can be advantages to static libraries as well, if you want to build an application that
does not depend on anything on the host system, or special-purpose commands where
you are not sure of the deployment environment. In general, however, shared libraries are recommended.
The dynamic linker/loader, ld.so, links symbol names to the appropriate shared library in which
they are defined at runtime.
Pages:
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428