Add instance context memory

This commit is contained in:
Brandon Fish
2019-02-10 14:24:36 -06:00
parent 0cfe864fe6
commit 7ef472dae2
4 changed files with 19 additions and 5 deletions

View File

@ -428,8 +428,16 @@ pub unsafe extern "C" fn wasmer_imports_set_import_func(
// };
}
#[allow(clippy::cast_ptr_alignment)]
#[no_mangle]
pub extern "C" fn wasmer_instance_context_memory(instance: *mut wasmer_instance_context_t) {}
pub extern "C" fn wasmer_instance_context_memory(
ctx: *mut wasmer_instance_context_t,
memory_idx: uint32_t,
) -> *const wasmer_memory_t {
let mut ctx = unsafe { Box::from_raw(ctx as *mut Ctx) };
let memory = ctx.memory(0);
memory as *const Memory as *const wasmer_memory_t
}
#[allow(clippy::cast_ptr_alignment)]
#[no_mangle]