Skip to content

Instantly share code, notes, and snippets.

@Hywan
Last active May 28, 2019 14:03
Show Gist options
  • Save Hywan/7217487ffa1a6725e1a5fb6a9cebdd88 to your computer and use it in GitHub Desktop.
Save Hywan/7217487ffa1a6725e1a5fb6a9cebdd88 to your computer and use it in GitHub Desktop.
Go Wasm example, import.rs
extern {
fn sum(x: i32, y: i32) -> i32;
}
#[no_mangle]
pub extern fn add1(x: i32, y: i32) -> i32 {
unsafe { sum(x, y) } + 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment