mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 22:51:32 +00:00
Add clif-backend crate and runtime example
This commit is contained in:
13
lib/runtime/examples/simple/main.rs
Normal file
13
lib/runtime/examples/simple/main.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use wasmer_runtime as runtime;
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
|
||||
static EXAMPLE_WASM: &'static [u8] = include_bytes!("simple.wasm");
|
||||
|
||||
fn main() {
|
||||
let compiler = CraneliftCompiler::new();
|
||||
let module = runtime::compile(EXAMPLE_WASM, &compiler).unwrap();
|
||||
let imports = runtime::Imports::new();
|
||||
let mut instance = module.instantiate(&imports).unwrap();
|
||||
let ret = instance.call("main", &[runtime::types::Value::I32(42)]);
|
||||
println!("ret: {:?}", ret);
|
||||
}
|
Reference in New Issue
Block a user