From 9893a51d2712f82a2ee57316a66bc26500eb3fdd Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 9 Aug 2026 16:11:57 +0200 Subject: feat: add reusable host imports and simplify function calls - make host definitions reusable across stores with gc-aware import linking - reorganize function calls, resumable execution, and typed value handling - expand typed tuples to arity 20 and update parser and store APIs Signed-off-by: Henry --- examples/reentrance.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/reentrance.rs') diff --git a/examples/reentrance.rs b/examples/reentrance.rs index 432fac7..8a1988e 100644 --- a/examples/reentrance.rs +++ b/examples/reentrance.rs @@ -22,7 +22,7 @@ fn main() -> Result<()> { let module = tinywasm::parse_bytes(&wasm)?; let mut store = Store::default(); - let call_add_twice = HostFunction::from(&mut store, |mut ctx: FuncContext<'_>, value: i32| { + let call_add_twice = HostFunction::from(|mut ctx: FuncContext<'_>, value: i32| { let add_one = ctx.module().func::(ctx.store(), "add_one")?; // Use ctx.call for reentrant calls from host functions. Function::call @@ -34,7 +34,7 @@ fn main() -> Result<()> { let mut imports = Imports::new(); imports.define("host", "call_add_twice", call_add_twice); - let instance = ModuleInstance::instantiate(&mut store, &module, Some(imports))?; + let instance = ModuleInstance::instantiate(&mut store, &module, Some(&imports))?; let run = instance.func::(&store, "run")?; assert_eq!(run.call(&mut store, 40)?, 52); -- cgit v1.3.1