#[no_mangle]
pub unsafe extern "C" fn wasm_func_new_with_env(
store: &mut wasm_store_t,
ty: &wasm_functype_t,
callback: wasm_func_callback_with_env_t,
data: *mut c_void,
finalizer: Option<extern "C" fn(arg1: *mut c_void)>,
) -> Box<wasm_func_t>
Expand description
Creates a new wasm_func_t
of type wasm_functype_t
for the wasm_store_t
.
- Calls the given
wasm_func_callback_t
when calling the returnedwasm_func_t
. - Unlike
wasm_func_new
this also allows to access environment data in the function closure.
Wraps Func::new
.
§Safety
It is the caller’s responsibility not to alias the wasm_functype_t
with its underlying, internal WasmStoreRef
.