Linkers, Loaders & Libraries
Computer Science: OCR A Level, topic 2.2.16
Linkers, Loaders & Libraries
When programming, we often use libraries built into programming languages to make coding solutions quicker and easier. These are linked in, by linkers, and loaded by loaders when your code runs.

Libraries
- Libraries exist in most programming languages and offer shorthand ways to achieve a task.
- These libraries are pre-written, compiled, tested and checked pieces of code that developers can rely on to help shorten code.
- Libraries give developers shortcuts to achieve what they want without keep repeating code.
- For example, the print function in python.

Linkers
- Linkers are the software responsible for linking libraries to code that uses them.
- Libraries can be statically linked or dynamically linked.
- Statically linked libraries are included in the object or machine code when it is compiled.
- This increases the binary footprint of the code, but the library becomes built into the code meaning an end user doesn’t need it to be installed.

Dynamically linked libraries
- Dynamically linked libraries are not built into the code.
- These libraries are loaded in when the object or machine code is passed to the CPU to run, just when it needs it.
- Dynamically linked libraries mean your binary footprint is smaller, but the library needs to be installed on the computer.

Loaders
- Loaders are a type of program that loads the program you're trying to run.
- Loaders are a part of the operating system that find a good place for object or machine code to sit in memory.
- For statically linked libraries all of the code and the library are loaded into memory, which takes up more room.
- For dynamically linked libraries, the loader will load the library into memory when the program needs it.
Test yourself on Linkers, Loaders & Libraries
Which type of library takes more space in memory when loaded by a loader?