Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In John R. Levine’s Linkers and Loaders, “Libraries” means collections of object files that a linker draws from to resolve symbols—not public or academic libraries. A static archive supplies selected object modules during linking; a shared object remains a dependency that the runtime loader handles when the program starts.

What does “library” mean in this chapter?

Chapter 6 of John R. Levine’s Linkers and Loaders concerns software libraries at the object-code level. Levine describes a library as “collections of object files that are included as needed in a linked program.” The chapter uses “module” for an object file stored in a library.

A library lets programmers reuse compiled routines without manually combining every object file for every program. When a program refers to a symbol—a function or data item whose definition is needed—the linker can search libraries for a module that provides it.

How does a linker select object files from an archive?

During linking, the linker tracks unresolved symbol references from the input it has processed. When a library contains a module defining a needed symbol, the linker can extract that module and incorporate its object code into the output executable. It need not copy every module in the archive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Disk-based archives commonly include directory or index information so the linker can locate candidate modules without reading the entire archive sequentially. Earlier collections stored on tape or as decks of cards could require sequential searching; linkers and loaders automated the selection of routines needed to resolve symbolic references.

How do static archives and shared objects differ?

Aspect Static archive Shared object
Common Unix-like filename suffix .a .so on Unix/Linux
When code is incorporated At link time, selected object modules are copied into the executable. The executable records a dependency; the runtime loader maps and resolves the shared object when the program starts.
Deployment implication The selected library code is carried in each executable that uses it. The executable depends on a shared library being available to the runtime loader.
Main management concern Updating library code generally requires relinking the executable. Loader paths, ABI compatibility, and library version management affect whether the dependency can be found and used.

These are general format distinctions, not a guarantee that every platform uses the same naming convention or loading policy. Levine’s chapter concentrates on traditional static libraries; shared libraries are treated in later chapters of the book.

Why might a linker report an undefined reference?

An undefined-reference error means the linker has not found a definition for a symbol required by the inputs it is linking. A definition may be absent from the supplied object files and libraries, or the relevant archive member may not have been selected to satisfy the unresolved reference in the link being performed. The error points to a missing resolution at link time; it is distinct from a shared library that cannot be found later by the runtime loader.

When is a shared library loaded?

In the model described here, a shared object is a runtime dependency: the executable records that dependency, and the runtime loader maps and resolves the shared object when the program starts. This defers some work from link time to program startup and makes runtime availability and compatibility important.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Further reading

For a book-length treatment, see John R. Levine’s Linkers and Loaders (Morgan Kaufmann, 2000), whose sixth chapter covers libraries. Open Library lists the physical edition as ISBN 9781558604964 and 272 pages.

Rank #4
Sale
Modern Compiler Design
  • Used Book in Good Condition

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.