The Runtime Theory
Compilation and Linking

From Source Files to a Running Program

A build turns source text and dependencies into an executable representation through distinct stages.

The Runtime Theory Team5 min read#compiler#linker#loader
▸ On this page

The model

A build turns source text and dependencies into an executable representation through distinct stages. A compiler typically parses and checks source, translates it to an intermediate or machine representation, and emits object files. A linker resolves references across those objects and libraries to produce a loadable program.

A concrete walk-through

If module A calls a function defined in module B, A’s object file can contain a symbol reference that the linker resolves. At startup, the operating system maps executable segments, prepares process state, and transfers control to runtime startup code before the application entry point.

Costs and failure cases

Compilation and linking errors indicate different classes of problems: a syntax or type error occurs before object generation, while an unresolved symbol is often discovered at link time. Dynamic linking can defer library resolution to load or runtime, introducing version and search-path concerns.

Check your understanding

A function declaration is visible to a source file, but the final build reports that its implementation is missing. Identify the likely build stage and two places to investigate.

Further reading

Computer Systems: A Programmer’s Perspective

Not started

Sign in to save your learning progress.

Sign in to save