C/C++
- The 4 Stages of Compilation
- Preprocessing
- Compilation
- Assembly
- Linking
- Compiling, Linking, Interpreting
- Assembly language
- Machine language
- Header files
- object file
- compiled from source
.c or .cpp
- extension
- dictated by the compiler
.o — gcc/clang
.obj — cl
- file format
- dictated by the OS
ELF (Executable and Linkable Format) — Linux
Mach-O (Mach Object Format) — macOS
COFF (Common Object File Format) — Windows
- static library
- Multiple object files are archived into one library file
- It is just container for multiple object files
- They are merged into executable during compilation process
.a (Archive) — Linux/macOS
.lib (Library) — Windows
- dynamic (shared) libraries
- These are compiled code containers kept separate from the final executable
- They are loaded into memory at runtime to save disk space and RAM.
.so (Shared object) — Linux
.dylib (Dynamic Library) — macOS
- uses
Mach-O (Mach Object) format
.dll (Dynamic-Link library) — Windows
- uses
PE (Portable Executable) format
- Searching for dynamic libraries for an executable
ldd — Linux
otool or llvm-otool — macOS
dumpbin — Windows
- Executable
- No extension
.exe — Windows