0Pricing
C++ Academy · Lesson

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);
}

All lessons in this course

  1. Extern C and the C ABI
  2. Calling Python from C++ via pybind11
  3. C++ for Rust FFI Boundaries
  4. Using SWIG for Multi-Language Bindings
← Back to C++ Academy