summaryrefslogtreecommitdiff
path: root/examples/rust/src/host_fn.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/rust/src/host_fn.rs')
-rw-r--r--examples/rust/src/host_fn.rs11
1 files changed, 11 insertions, 0 deletions
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) }
+}