SPRAB89A September 2011 – March 2014
Systems differ in the dynamic linking models they support. In UNIX systems, including Linux, dynamic linking is designed to be transparent from the application's point of view. That is, a program or library can be written and compiled without regard to whether any unresolved references will be resolved statically or dynamically. For example if a program declares “extern int f()” and then calls f, the compiler generates code that enables f to be resolved either statically or dynamically. The main advantage to this approach is flexibility: programs can be written and compiled without regard to how they will be linked. The main drawback is that it may be less efficient, as the compiler must assume that any extern reference may not be resolved statically, and generate the appropriate addressing code to support dynamic linking.
Unix refers to dynamically linked libraries as Dynamic Shared Objects, or DSOs.
In Windows and various embedded systems such as Symbian and PalmOS, dynamic linking is explicitly specified in the source code for a symbol declaration via a language extension, usually _ _declspec(import). The advantage of this approach is that the compiler explicitly knows when to generate the special addressing required. These systems commonly have a post-link phase that replaces dynamic linkage via symbolic references with a symbol indexing scheme. These systems refer to shared libraries as Dynamic Link Libraries, or DLLs.