mumustd/
lib.rs

1// src/lib.rs
2//
3// std-mumu — Standard I/O tools for MuMu/Lava
4//
5// This is the crate root; it exposes shared utilities and registers all bridges.
6// Dynamic entrypoint (Cargo_lock) is provided for native builds so
7// `extend("std")` can load the plugin at runtime.
8//
9
10pub mod share;
11pub mod register;
12
13pub use register::register_all;
14
15#[cfg(not(target_arch = "wasm32"))]
16#[no_mangle]
17pub unsafe extern "C" fn Cargo_lock(
18    interp_ptr: *mut std::ffi::c_void,
19    _extra: *const std::ffi::c_void,
20) -> i32 {
21    use core_mumu::parser::interpreter::Interpreter;
22
23    if interp_ptr.is_null() {
24        return 1;
25    }
26    let interp = &mut *(interp_ptr as *mut Interpreter);
27    register_all(interp);
28    0
29}