Skip to content

Instantly share code, notes, and snippets.

@TheWaWaR
Created March 20, 2025 02:54
Show Gist options
  • Save TheWaWaR/d614570142527b1b6511050b63e78d39 to your computer and use it in GitHub Desktop.
Save TheWaWaR/d614570142527b1b6511050b63e78d39 to your computer and use it in GitHub Desktop.
Define wasm import module name in Rust
#[link(wasm_import_module = "lunar")]
unsafe extern "C" {
pub fn get_renderer(input_length: usize) -> i64;
}
#[unsafe(no_mangle)]
pub extern "C" fn add_u32(a: u32, b: u32) -> u32 {
unsafe {
let _ = get_renderer(33usize);
}
a + b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment