What is a linker, and what are dynamic and static linking?
Link editors are commonly known as linkers. The compiler
automatically invokes the linker as the last step in compiling a
program. The linker inserts code (or maps in shared libraries) to
resolve program library references, and/or combines object modules
into an executable image suitable for loading into
memory. On Unix-like systems, the linker is typically
invoked with the
Static linking is the result of the linker copying all library routines used in the program into the executable image. This may require more disk space and memory than dynamic linking, but is both faster and more portable, since it does not require the presence of the library on the system where it is run.
Dynamic linking is accomplished by placing the name of a sharable library in the executable image. Actual linking with the library routines does not occur until the image is run, when both the executable and the library are placed in memory. An advantage of dynamic linking is that multiple programs can share a single copy of the library.
This document was developed with support from National Science Foundation (NSF) grant OCI-1053575. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF.
This is document akqn in the Knowledge Base.
Last modified on 2015-06-23.
- Fill out this form to submit your issue to the UITS Support Center.
- Please note that you must be affiliated with Indiana University to receive support.
- All fields are required.