Compiling Object Files

A compiler (say, a C compiler) translates a source file into an object file: a fragment of the future program that must be later linked with other object files (in all non-trivial cases) and with system and application-specific libraries (almost always). The name of an object file usually is the same as the source file’s name with the extension changed to o or obj.

An object file contains the executable code, the names of all global objects (variables and functions), and all unresolved external references (variables and functions, collectively known as symbols). It may also include debugging numbers), but debugging is outside this book’s scope.

As an example, here are the first 2560 bytes (the so-called hexadecimal ...

Get Resourceful Code Reuse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.