Skip to main content

build_native_cdylib

Function build_native_cdylib 

pub fn build_native_cdylib(
    rust_source: &str,
    crate_name: &str,
    work_dir: &Path,
) -> Result<PathBuf, String>
Expand description

Build AOT-native cdylib Rust source (from compile_function_to_native_rust) into a loadable cdylib (HOTSWAP §Axis-3 / P16). Generates a minimal crate under work_dir/<crate_name>, copies the shared runtime crates (so the .so and the interpreter share the SAME logicaffeine_data ABI), and runs cargo build --release. Returns the path to the produced dynamic library. panic = "unwind" (the default) — NOT abort — so a panic in a loaded function can be contained rather than killing the host process.