Skip to main content

Module codegen_c

Module codegen_c 

Source
Expand description

C ABI bridge: drop-in extern "C" replacements with the original names and signatures.

The port is safe Rust over C’s ABI types (c_int, usize, f64, …), with each const char * as Option<&[u8]> (None for NULL). lib.rs is the only place with unsafe: reading C strings, and exporting unmangled symbols.

Functions§

cargo_toml
header
include/<lib>.h: the prototypes, and the rust_anything_ aliases.
lib_rs
port_rs
shadow_c
A C shadow file: each function calls the original (compiled renamed) and the Rust port.
shadow_flags
-D flags that rename the originals for a shadow build.