mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-23 21:51:32 +00:00
Push debugging stuff to help debug calls not working
This commit is contained in:
26
lib/runtime/examples/test.rs
Normal file
26
lib/runtime/examples/test.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use wabt::wat2wasm;
|
||||
use wasmer_runtime::types::Value;
|
||||
use wasmer_runtime::{Instance, Imports, module::Module};
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
|
||||
fn main() {
|
||||
let mut instance = create_module_1();
|
||||
let result = instance.call("func-0", &[]);
|
||||
println!("result: {:?}", result);
|
||||
}
|
||||
|
||||
fn create_module_1() -> Box<Instance> {
|
||||
let module_str = "(module
|
||||
(type (;0;) (func (result i32)))
|
||||
(func (;0;) (type 0) (result i32)
|
||||
i32.const 306)
|
||||
(func (;1;) (type 0) (result i32)
|
||||
call 0)
|
||||
(export \"type-i32\" (func 1))
|
||||
(export \"func-0\" (func 0))
|
||||
)
|
||||
";
|
||||
let wasm_binary = wat2wasm(module_str.as_bytes()).expect("WAST not valid or malformed");
|
||||
let module = wasmer_runtime::compile(&wasm_binary[..], &CraneliftCompiler::new()).expect("WASM can't be compiled");
|
||||
module.instantiate(&Imports::new()).expect("WASM can't be instantiated")
|
||||
}
|
Reference in New Issue
Block a user