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.

Structs§

CStruct
A struct of scalar fields that crosses the bridge by value.

Enums§

CKind
How a C parameter crosses the bridge.

Functions§

c_decl
A C declaration of name with type c_type (const uint8_t *in).
c_prototype
The function’s prototype with typedefs resolved to the scalars they stand for, so it compiles without the project’s headers.
c_struct
The struct a dialect type stands for (struct:AVRational:int num,int den).
c_struct_defs
C definitions of m’s structs, for files that do not include the project’s headers.
cargo_toml
header
include/<lib>.h: the prototypes, and the rust_anything_ aliases.
kind
lib_rs
pointee
What a pointer type points to, without const.
port_rs
returns_into
The parameter a returned pointer points into (returns is ptr:<index>).
shadow_c
A C shadow file: each function calls the original (compiled renamed) and the Rust port. The port gets copies of what the function writes, so the caller sees the original’s writes once, and both are compared.
shadow_flags
-D flags that rename the originals for a shadow build.
structs
The structs m’s functions take or return by value, each once.
writes
Whether recorded results carry what the function wrote through its pointers.