mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
fix more cases of passing imports by reference to instantiate
This commit is contained in:
parent
d82155f558
commit
c771f2e677
@ -45,14 +45,14 @@ fn main() -> Result<()> {
|
||||
},
|
||||
};
|
||||
|
||||
let inner_instance = inner_module.instantiate(import_object)?;
|
||||
let inner_instance = inner_module.instantiate(&import_object)?;
|
||||
|
||||
let outer_imports = imports! {
|
||||
"env" => inner_instance,
|
||||
};
|
||||
|
||||
let outer_module = wasmer_runtime_core::compile_with(EXAMPLE_WASM, &CraneliftCompiler::new())?;
|
||||
let outer_instance = outer_module.instantiate(outer_imports)?;
|
||||
let outer_instance = outer_module.instantiate(&outer_imports)?;
|
||||
let ret = outer_instance.call("main", &[Value::I32(42)])?;
|
||||
println!("ret: {:?}", ret);
|
||||
|
||||
|
@ -27,7 +27,7 @@ fn create_module_1() -> Instance {
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
module
|
||||
.instantiate(generate_imports())
|
||||
.instantiate(&generate_imports())
|
||||
.expect("WASM can't be instantiated")
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ pub fn generate_imports() -> ImportObject {
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
let instance = module
|
||||
.instantiate(ImportObject::new())
|
||||
.instantiate(&ImportObject::new())
|
||||
.expect("WASM can't be instantiated");
|
||||
let mut imports = ImportObject::new();
|
||||
imports.register("spectest", instance);
|
||||
|
@ -25,7 +25,7 @@ mod tests {
|
||||
let module = wasmer_runtime_core::compile_with(&wasm_binary[..], &CraneliftCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
let instance = module
|
||||
.instantiate(ImportObject::new())
|
||||
.instantiate(&ImportObject::new())
|
||||
.expect("WASM can't be instantiated");
|
||||
let result = instance.call("stack-overflow", &[]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user