Add clif-backend crate and runtime example

This commit is contained in:
Lachlan Sneff
2019-01-08 16:04:03 -05:00
parent 8a73ff71af
commit 7324c85749
14 changed files with 2378 additions and 10 deletions

View 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);
}