| 86 | } |
| 87 | |
| 88 | fn tinywasm_no_std() -> Result<()> { |
| 89 | let module = tinywasm::parse_file("./examples/rust/out/tinywasm_no_std.wasm")?; |
| 90 | let mut store = Store::default(); |
| 91 | |
| 92 | let mut imports = Imports::new(); |
| 93 | imports.define("env", "printi32", HostFunction::from(&mut store, |_: FuncContext<'_>, _x: i32| Ok(()))); |
| 94 | let instance = ModuleInstance::instantiate(&mut store, &module, Some(black_box(imports)))?; |
| 95 | |
| 96 | let hello = instance.func::<(), ()>(&store, "hello")?; |
| 97 | hello.call(&mut store, black_box(()))?; |
| 98 | hello.call(&mut store, black_box(()))?; |
| 99 | hello.call(&mut store, black_box(()))?; |
| 100 | Ok(()) |
| 101 | } |
| 102 | |
| 103 | fn hello() -> Result<()> { |
| 104 | let module = tinywasm::parse_file("./examples/rust/out/hello.opt.wasm")?; |