Linkers, Loaders & Executables
A dynamically linked program copied to another computer fails to start. What is the most likely cause?
- AThe executable contains all library code and is too large
- BDynamically linked programs are allowed to run only on the computer that built them
- CA required shared library is missing or only an incompatible version is installed
Show answer and explanation
Answer: C. A required shared library is missing or only an incompatible version is installed
A dynamically linked program uses the shared libraries on the computer where it runs. If a required library is absent, or only an older version lacking some functions is present, the dynamic linker cannot bind it and start-up fails. On Linux the ldd command shows which shared libraries a program needs and whether they are found. Some developers choose static linking deliberately to make distribution easier.
- A. With dynamic linking, library code is not in the executable.
- B. There is no such rule.
- C. Correct. It depends on the libraries on the target system.