Linkers, Loaders & Executables
Which describes static linking?
- AThe code of the libraries used is copied into the executable
- BThe libraries are loaded and bound every time the program runs
- CAll processing is written in one source file without libraries
Show answer and explanation
Answer: A. The code of the libraries used is copied into the executable
With static linking, the linker extracts the needed functions from static libraries (.a files on Linux) and builds them into the executable. It runs even where the library is absent and needs no binding at start-up, but the executable grows and every program using the library carries its own copy. Fixes to the library are not picked up unless the program is rebuilt.
- A. Correct. The executable runs on its own.
- B. That is dynamic linking.
- C. That is unrelated to whether libraries are used.