You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any API to add a function from an other module?
Additional Details
I'm trying to merge two WASM files.
In the first step, I want to merge the functions, but I'm not able to add the function from the module_b to the module_a.
As use can see below, I'm using module.funcs.add_local but the method is expecting a LocalFunction but I didn't find a way to extract the function as a LocalFunction nor did I figure out a way to create it from the Function.
I'm using add_local because I didn't find any other method that allowed me to add a new function to a module.
Is there an API for my use case, or is this currently not supported? (Or am I missing something?.. )
Thanks in advance
use anyhow::Error;use walrus::*;fnmain() -> Result<(),Error>{let module_a = Module::from_file("fancy.wasm")?;let module_b = Module::from_file("add.wasm")?;// module_b constians only one funclet my_fancy_func = module_b.funcs.iter().next().unwrap();// let module_a.funcs.add(my_fancy_func)// mismachted types exepected struct 'LocalFunction', found 'walrus::Function'
module_a.funcs.add_local(*my_fancy_func);Ok(())}
The text was updated successfully, but these errors were encountered:
Summary
Is there any API to add a function from an other module?
Additional Details
I'm trying to merge two WASM files.
In the first step, I want to merge the functions, but I'm not able to add the function from the module_b to the module_a.
As use can see below, I'm using
module.funcs.add_local
but the method is expecting aLocalFunction
but I didn't find a way to extract the function as aLocalFunction
nor did I figure out a way to create it from theFunction
.I'm using
add_local
because I didn't find any other method that allowed me to add a new function to a module.Is there an API for my use case, or is this currently not supported? (Or am I missing something?.. )
Thanks in advance
The text was updated successfully, but these errors were encountered: