What is Static library?

An archive bundling many object files (.a on Linux). During static linking, the linker extracts only the objects it needs into the executable.

Field: Linkers, Loaders & Executables

Static library in the explanations

Questions that mention Static library (2)

  1. When linking with a static library (.a file), what does the linker put into the executable?
  2. With the GNU linker, writing a static library before the object file that uses it, as in "gcc -lmylib main.o", can cause undefined-reference errors. Why?

Related terms

Linker Object file Address space layout randomization (ASLR) BSS section Dynamic linker Dynamic linking Entry point Executable and Linkable Format (ELF) Global offset table Heap memory

Back to the glossary