Skip to main content

16.6) Shared Objects


Library archives such as libdata.a are static libraries and the process of linking against them is known as static linking.

In static linking, object code from library archives is copied into the executable file. This means that executables can become very large on disk, particularly if many libraries are linked; it also means that the object code of common functions gets duplicated many times, both on disk and in memory.

An alternative approach is dynamic linking, which allows one copy of library code to exist on disk and in memory, referenced dynamically by multiple programs. To do dynamic linking on UNIX-like systems, we need to create a dynamic library - also known as a shared object.