Add memory data function

This commit is contained in:
Brandon Fish
2019-02-10 15:20:35 -06:00
parent a502da58e3
commit 66bf13c9dd
4 changed files with 23 additions and 1 deletions

View File

@ -439,6 +439,14 @@ pub extern "C" fn wasmer_instance_context_memory(
memory as *const Memory as *const wasmer_memory_t
}
#[allow(clippy::cast_ptr_alignment)]
#[no_mangle]
pub extern "C" fn wasmer_memory_data(mem: *mut wasmer_memory_t) -> *mut uint8_t {
let memory = mem as *mut Memory;
use std::cell::Cell;
unsafe { ((*memory).view::<u8>()[..]).as_ptr() as *mut Cell<u8> as *mut u8 }
}
#[allow(clippy::cast_ptr_alignment)]
#[no_mangle]
pub extern "C" fn wasmer_memory_data_length(mem: *mut wasmer_memory_t) -> uint32_t {