主题: ffi
-
CString at an FFI boundary: distinguish a borrowed pointer from transferred ownership
Keep the CString owner alive for borrowed calls and use raw ownership conversion only under an explicit return contract.
-
Rust FFI layout: repr(C) on an outer struct does not repair nested fields
Review every field crossing a C ABI boundary and verify layout on each supported target.
-
Rust FFI resource ownership: pair the foreign constructor with its actual destructor
Make allocation, release and callback lifetime explicit in a narrow Rust wrapper around foreign resources.
-
Rust FFI unwinding: choose an explicit panic and exception boundary
Separate ordinary error returns, Rust panics and foreign exceptions before selecting the boundary ABI.
机器可读: JSON