Add Wasmtime C API function to control linker shadowing.

This commit is contained in:
Peter Huene
2020-03-26 11:26:04 -07:00
parent 2d43d5a8fa
commit 382f68c620
5 changed files with 25 additions and 11 deletions

View File

@@ -142,13 +142,18 @@ pub struct wasmtime_linker_t {
}
#[no_mangle]
pub unsafe extern "C" fn wasmtime_linker_new(
store: *mut wasm_store_t,
pub unsafe extern "C" fn wasmtime_linker_new(store: *mut wasm_store_t) -> *mut wasmtime_linker_t {
Box::into_raw(Box::new(wasmtime_linker_t {
linker: Linker::new(&(*store).store.borrow()),
}))
}
#[no_mangle]
pub unsafe extern "C" fn wasmtime_linker_allow_shadowing(
linker: *mut wasmtime_linker_t,
allow_shadowing: bool,
) -> *mut wasmtime_linker_t {
let mut linker = Linker::new(&(*store).store.borrow());
linker.allow_shadowing(allow_shadowing);
Box::into_raw(Box::new(wasmtime_linker_t { linker }))
) {
(*linker).linker.allow_shadowing(allow_shadowing);
}
#[no_mangle]