6. Static versus Dynamic Linking

When linking against routines contained in a software library (e.g., a .so or .a file on a Unix machine, or a .lib or .dll file on a MS Windows machine), one can link statically or dynamically. If linking is static, the link-editor will extract a relocatable object from a library and this object will become part of the final executable; if linking is dynamic inclusion of the object is deferred until process execution.

Statically linked executables usually load faster but are bigger. Dynamically linked executables usually load more slowly but are smaller. Dynamic linking requires that the libraries in which the required objects reside be available to the executable at run-time.

6.1. Unix

Under static mode, the linker will accepts only relocatable objects or archive libraries (.a files) as input files; under dynamic mode, the linker also accepts shared objects (.so files).

Further information can be found on the Sun documentation site in the Linker and Libraries Guide.

6.2. Microsoft Windows

Under MS Windows, one statically links against a .lib file and dynamically links against a .dll file.

...previousup (conts)next...



About this document:

Produced from the SGML: /home/isd/public_html/_nag/_reml_grp/nag.reml
On: 25/7/2002 at 9:59:25
Options: reml2 -i noindex -l long -o html -p multiple