mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 06:08:29 +00:00
feat(c-api) Support null pointers in wasm_func_new_with_env.
This commit is contained in:
14
lib/c-api/src/wasm_c_api/externals/function.rs
vendored
14
lib/c-api/src/wasm_c_api/externals/function.rs
vendored
@@ -87,13 +87,17 @@ pub unsafe extern "C" fn wasm_func_new(
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wasm_func_new_with_env(
|
||||
store: &wasm_store_t,
|
||||
function_type: &wasm_functype_t,
|
||||
callback: wasm_func_callback_with_env_t,
|
||||
store: Option<&wasm_store_t>,
|
||||
function_type: Option<&wasm_functype_t>,
|
||||
callback: Option<wasm_func_callback_with_env_t>,
|
||||
env: *mut c_void,
|
||||
finalizer: wasm_env_finalizer_t,
|
||||
finalizer: Option<wasm_env_finalizer_t>,
|
||||
) -> Option<Box<wasm_func_t>> {
|
||||
// TODO: handle null pointers?
|
||||
let store = store?;
|
||||
let function_type = function_type?;
|
||||
let callback = callback?;
|
||||
let finalizer = finalizer?;
|
||||
|
||||
let func_sig = &function_type.inner().function_type;
|
||||
let num_rets = func_sig.results().len();
|
||||
let inner_callback =
|
||||
|
||||
Reference in New Issue
Block a user