diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2025-02-12 19:13:23 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2025-02-12 19:13:23 +0100 |
| commit | d6493c277eb1104aaf72a8e0e6959ce3d1cc4932 (patch) | |
| tree | a82452aeb44be6b79d15fc83ddfcbd12a965520a /examples/rust/src/tinywasm_no_std.rs | |
| parent | 7e668f9e321c941f38395e47a29501dce0fc81a9 (diff) | |
fix: fix build, improve error handling
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'examples/rust/src/tinywasm_no_std.rs')
| -rw-r--r-- | examples/rust/src/tinywasm_no_std.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<FreeListAllocator> = 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( |
