Change memory api a little

This commit is contained in:
Lachlan Sneff
2019-01-29 12:12:37 -08:00
parent 4c266c6fb9
commit d73c7015fb
5 changed files with 63 additions and 54 deletions

View File

@ -58,9 +58,14 @@ fn main() -> Result<()> {
Ok(())
}
extern "C" fn print_num(n: i32, _vmctx: &mut vm::Ctx) -> i32 {
extern "C" fn print_num(n: i32, ctx: &mut vm::Ctx) -> i32 {
println!("print_num({})", n);
n + 1
let memory = ctx.memory(0);
let a: i32 = memory.read(0).unwrap();
a + n + 1
}
static IMPORT_MODULE: &str = r#"