Language Runtimes · Cluster
FFI and Interop
Calling conventions across language boundaries.
- 01 The C Calling Convention as an Interoperability Contract How arguments, return values, and stack alignment are encoded at a call site, and why extern C is a narrower promise than most callers assume.
- 02 Symbol Mangling and Linkage in Cross-Language Calls Why C++ and Rust rename functions before the linker sees them, how name mangling differs between compilers, and what dlsym requires of an exported symbol.
- 03 Struct Passing and Register Classification Across ABIs How a compiler decides whether a struct travels in registers or in memory, what the eightbyte classification rules encode, and where layouts diverge between C and other languages.
- 04 String Encoding and Buffer Ownership at the FFI Boundary Why passing a string across a language boundary requires agreeing on encoding, termination, and allocation, and how the two-call pattern avoids guessing at buffer sizes.
- 05 Allocator Mismatch and Cross-Runtime Deallocation Why freeing memory across a language boundary corrupts the heap, how separate C runtimes end up with separate heaps, and which API shapes make the allocator identity explicit.
- 06 Native Callbacks Into Managed Code How a C library invokes a function pointer that lands in a garbage-collected runtime, why the trampoline cannot simply be the managed function, and what keeps the target alive.
- 07 Unwinding Across an FFI Boundary Why an exception cannot safely propagate through a C frame, how table-based unwinding locates a handler, and what a boundary must do instead of throwing through it.
- 08 Attaching Foreign Threads to a Managed Runtime What a runtime needs from a thread before managed code can run on it, why a library-spawned worker thread has none of it, and how attach and detach bracket the transition.
- 09 Opaque Handles and Ownership Transfer in C APIs Why handle-based interfaces survive changes that struct-based ones cannot, how borrowing differs from transfer, and what an invalidated handle means to the caller.
- 10 Designing a C ABI That Survives Version Changes Which parts of an interface are frozen by binary compatibility, how struct sizing and symbol versioning let a library grow, and what a versioned entry point must promise.