0Pricing
C Academy · Lesson

Static and Shared Libraries

Build and link libraries.

What A Library Is

A library is a bundle of compiled object files you can reuse across programs without recompiling the source each time.

C has two kinds:

  • Static libraries (.a) copied into the executable at link time
  • Shared libraries (.so) loaded at run time

Building Object Files

Both kinds start from object files. Compile your sources with -c as usual.

These .o files are the raw material the archiver or linker will package.

gcc -c mathlib.c -o mathlib.o
gcc -c strlib.c -o strlib.o

All lessons in this course

  1. Conditional Compilation
  2. Multi-File Projects
  3. Makefiles
  4. Static and Shared Libraries
← Back to C Academy