Building and Linking Static and Shared Libraries with Makefiles
Library Creation and Linking Basics
Consider a C++ project with the following structure:
add.h
int compute_sum(int x, int y);
add.cpp
#include "add.h"
int compute_sum(int x, int y)
{
return x + y;
}
main.cpp
#include <iostream>
#include "add.h"
int main()
{
std::cout << compute_sum(1, 2) << std: ...
Posted on Sat, 12 Sep 2026 16:40:00 +0000 by MattMan
From Source to Executable: The Translation Pipeline Explained
The historical development of compilers and programming languages reveals a fascinating paradox: which came first, the language or the compiler? Early computers relied on punch cards for input, which was highly inefficient. The first programming languages, such as assembly, emerged to simplify machine communication. However, the initial compile ...
Posted on Mon, 24 Aug 2026 16:10:20 +0000 by idnoble
Cross-Platform Dynamic and Static Library Generation with CMake
On Windows, function symbols are not exported by default from dynamic libraries. You must explicitly annotate the functions:
Use __declspec(dllexport) for functions to be exported when building the library.
Use __declspec(dllimport) for functions to be imported when consuming the library.
A common approach is to use a macro that switches betw ...
Posted on Tue, 16 Jun 2026 17:09:36 +0000 by jek1134