TOC
Previous
Next
Run-time symbol resolution (cont.)
Rationale is historic: shared libraries were designed so that
semantics for
symbol resolution were the same as for programs that
used statically linked libraries.
-
Definition of a symbol in main program overrides
definition in shared library.
-
If a symbol has global definitions in multiple libraries,
then run-time reference is bound by scanning libraries
in the
left-to-right order that they were specified on static link line.
These semantics made transition to shared libraries easy.
But can cause complications:
-
Conflicts with model of shared-library as self-contained sub-system.
-
Semantics of library can change when library is aggregated into larger units.
-
Can make it difficult to do divide-and-conquer debugging
(i.e., reproduce problem using fewer or different shared libraries).
(C) 2006, Michael Kerrisk