feat: add dependency
This commit is contained in:
@@ -1,11 +1,2 @@
|
||||
wit_bindgen_guest_rust::generate!("../interface.wit");
|
||||
|
||||
struct Exports;
|
||||
|
||||
export_smoke!(Exports);
|
||||
|
||||
impl smoke::Smoke for Exports {
|
||||
fn thunk() {
|
||||
imports::thunk();
|
||||
}
|
||||
}
|
||||
mod mem;
|
||||
|
||||
13
javascript-engine/src/mem.rs
Normal file
13
javascript-engine/src/mem.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
#[no_mangle]
|
||||
pub unsafe fn malloc(len: usize) -> *mut u8 {
|
||||
let align = std::mem::align_of::<usize>();
|
||||
let layout = std::alloc::Layout::from_size_align_unchecked(len, align);
|
||||
std::alloc::alloc(layout)
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn free(ptr: *mut u8, len: usize) {
|
||||
let align = std::mem::align_of::<usize>();
|
||||
let layout = std::alloc::Layout::from_size_align_unchecked(len, align);
|
||||
std::alloc::dealloc(ptr, layout)
|
||||
}
|
||||
Reference in New Issue
Block a user