mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-22 13:11:32 +00:00
Rework imports
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
use std::rc::Rc;
|
||||
use wabt::wat2wasm;
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
use wasmer_runtime::{import::Imports, Instance};
|
||||
@ -9,13 +8,13 @@ fn main() {
|
||||
println!("result: {:?}", result);
|
||||
}
|
||||
|
||||
fn generate_imports() -> Rc<Imports> {
|
||||
fn generate_imports() -> Imports {
|
||||
// let wasm_binary = wat2wasm(IMPORT_MODULE.as_bytes()).expect("WAST not valid or malformed");
|
||||
// let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
||||
// let instance = module.instantiate(Rc::new(Imports::new())).expect("WASM can't be instantiated");
|
||||
let imports = Imports::new();
|
||||
// imports.register("spectest", instance);
|
||||
Rc::new(imports)
|
||||
imports
|
||||
}
|
||||
|
||||
fn create_module_1() -> Instance {
|
||||
@ -34,6 +33,6 @@ fn create_module_1() -> Instance {
|
||||
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new())
|
||||
.expect("WASM can't be compiled");
|
||||
module
|
||||
.instantiate(generate_imports())
|
||||
.instantiate(&generate_imports())
|
||||
.expect("WASM can't be instantiated")
|
||||
}
|
||||
|
Reference in New Issue
Block a user