feat: add dependency

This commit is contained in:
2023-01-20 22:36:19 +08:00
parent 68e8d103b4
commit cf8e579f27
644 changed files with 150099 additions and 14 deletions

View File

@@ -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;

View 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)
}