Fix memory issue with Emscripten

This commit is contained in:
Mark McCaskey
2020-08-04 17:09:00 -07:00
parent 354c331bcb
commit 7e9d9cab08
7 changed files with 53 additions and 13 deletions

View File

@@ -129,6 +129,7 @@ pub unsafe fn allocate_on_stack<'a, T: Copy>(ctx: &'a mut EmEnv, count: u32) ->
.unwrap()
.call(count * (size_of::<T>() as u32))
.unwrap();
let addr = emscripten_memory_pointer!(ctx.memory(0), offset) as *mut T;
let slice = slice::from_raw_parts_mut(addr, count as usize);