LINKERS, LOADERS AND LIBRARIES

— LINKERS, LOADERS AND LIBRARIES


Libraries

A library is a collection of pre-written routines, procedures or functions that can be reused by programs.

Purpose

  • Reduce development time

  • Improve reliability

  • Promote code reuse

Advantages

  • Faster development

  • Tested code

  • Reduced costs

Disadvantages

  • Dependency issues

  • Increased program size

  • Less control over implementation


Linker

A linker is system software that combines object code modules and required library code to produce an executable program.

Functions

  • Combine object files

  • Resolve external references

  • Link library routines

  • Produce executable code


Loader

A loader is system software that loads an executable program from secondary storage into RAM for execution.

Functions

  • Locate executable

  • Load into memory

  • Allocate memory

  • Prepare execution environment

  • Start execution


Compilation Process Including Linker and Loader

Source Code
     ↓
Compiler
     ↓
Object Code
     ↓
Linker
     ↓
Executable Program
     ↓
Loader
     ↓
RAM
     ↓
Execution