LOGBOOK

HELP

Quiz Entry - updated: 2026.07.10

What are the two main reasons for using linkers?

Modularity (split a program into separately-compiled files and reusable libraries) and efficiency (recompile/relink only what changed, and include only the library code you actually use).

Modularity:

  • Programs can be split into smaller source files
  • Teams can work on different files independently
  • Libraries provide reusable common functions (math library, libc)

Efficiency:

  • Time: Separate compilation - only recompile changed files, then relink
  • Space: Libraries aggregate common functions, but executables only include what they actually use

Example:

# Only recompile the changed file
# Changed file
$ gcc -c swap.c
# Relink
$ gcc -o prog main.o swap.o
# No need to recompile main.c!

Tip: This is why large projects use build systems like Make - they track dependencies and only rebuild what changed.

Go deeper:

From Quiz: REVE1 / Program Execution | Updated: Jul 10, 2026