From d6493c277eb1104aaf72a8e0e6959ce3d1cc4932 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Wed, 12 Feb 2025 19:13:23 +0100 Subject: fix: fix build, improve error handling Signed-off-by: Henry Gressmann --- examples/rust/src/host_fn.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 examples/rust/src/host_fn.rs (limited to 'examples/rust/src/host_fn.rs') diff --git a/examples/rust/src/host_fn.rs b/examples/rust/src/host_fn.rs new file mode 100644 index 0000000..ada74bd --- /dev/null +++ b/examples/rust/src/host_fn.rs @@ -0,0 +1,11 @@ +#![no_main] + +#[link(wasm_import_module = "env")] +unsafe extern "C" { + fn bar(left: i64, right: i32) -> i32; +} + +#[unsafe(no_mangle)] +pub fn foo() -> i32 { + unsafe { bar(1, 2) } +} -- cgit v1.3.1