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/tinywasm_no_std.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/rust/src/tinywasm_no_std.rs') diff --git a/examples/rust/src/tinywasm_no_std.rs b/examples/rust/src/tinywasm_no_std.rs index 9a31d20..46f1785 100644 --- a/examples/rust/src/tinywasm_no_std.rs +++ b/examples/rust/src/tinywasm_no_std.rs @@ -16,11 +16,11 @@ static ALLOCATOR: AssumeSingleThreaded = unsafe { AssumeSingleThreaded::new(FreeListAllocator::new()) }; #[link(wasm_import_module = "env")] -extern "C" { +unsafe extern "C" { fn printi32(x: i32); } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn hello() { let _ = run(); } @@ -30,7 +30,7 @@ fn run() -> tinywasm::Result<()> { let mut imports = tinywasm::Imports::new(); let res = tinywasm::parser::Parser::new().parse_module_bytes(include_bytes!("./print.wasm"))?; - let twasm = res.serialize_twasm(); + let twasm = res.serialize_twasm()?; let module = tinywasm::Module::parse_bytes(&twasm)?; imports.define( -- cgit v1.3.1