Better Wasmtime API for embedder (#287)

* Migrate wasm-rust-api code to wasmtime.
This commit is contained in:
Yury Delendik
2019-08-21 02:27:42 -05:00
committed by Dan Gohman
parent 8ea883a603
commit f88e92a57c
23 changed files with 2797 additions and 29 deletions

View File

@@ -0,0 +1,19 @@
//! Utility module to create trampolines in/out WebAssembly module.
mod code_memory;
mod create_handle;
use failure::Error;
use std::cell::RefCell;
use std::rc::Rc;
use self::create_handle::create_handle;
use super::externals::Func;
pub fn generate_func_export(f: &Rc<RefCell<Func>>) -> Result<(), Error> {
let mut instance = create_handle(f)?;
let export = instance.lookup("trampoline").expect("trampoline export");
f.borrow_mut().anchor = Some((instance, export));
Ok(())
}