Extern C and the C ABI
Expose C-compatible interfaces from C++ libraries with extern C.
Why Interop?
C++ has a complex ABI (Application Binary Interface) with name mangling, exceptions, templates. Other languages (C, Python, Rust) cannot consume mangled C++ symbols directly.
extern "C"
Wrap declarations in extern "C" to disable C++ name mangling and use the C calling convention.
extern "C" {
void greet(const char* name);
int add(int a, int b);
}