C ABI
The i686 cdecl subset supports scalars, raw pointers, and compatible C function pointers; aggregate interoperability uses pointers to repr(C) storage.
DByte 12.0 · Language
Contract§
pub extern "C" fn dbyte_add_one(value: i32) -> i32:
return value + (1 as i32)
Source: source-examples/v12.0.0/c_abi.dby
Mechanics§
The i686 C subset follows cdecl: right-to-left arguments, caller cleanup, scalar EAX return, preserved EBX/ESI/EDI/EBP and explicit stack alignment. Interop aggregates cross through pointers to repr(C) or packed storage.
Validation and failure§
Struct-by-value, payload enums, varargs, unions, large returns, C++ and exceptions are rejected. Pointer mutability and callable convention must match.
Evidence and boundary§
Pinned clang 22 creates only the C fixture object; DByte creates its objects, archive and final ELF, then QEMU checks calls, callbacks, narrow values, cleanup and callee-saved registers.
Executable example§
pub extern "C" fn dbyte_add_one(value: i32) -> i32:
return value + (1 as i32)