How Shared Libraries Work
The specifics of how POSIX-compliant operating systems implement shared libraries vary from platform to platform, but the general idea is the same. Shared libraries provide chunks of executable code that the operating system can load into a program's address space and execute. The following discussion applies to shared-library references that the linker resolves when a program is built and the operating system loader resolves when the program is loaded.
Dynamic Linking at Load Time
As a program executable image is being built, the linker (formally called a link editor) maintains a table of symbols—function entry points and global data addresses. Each symbol referenced within the accumulating body of object code is added ...