MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / wasmtime_linker_define_func

Function wasmtime_linker_define_func

crates/c-api/src/linker.rs:70–86  ·  view source on GitHub ↗
(
    linker: &mut wasmtime_linker_t,
    module: *const u8,
    module_len: usize,
    name: *const u8,
    name_len: usize,
    ty: &wasm_functype_t,
    callback: crate::wasmtime_func_callback_t,
 

Source from the content-addressed store, hash-verified

68
69#[unsafe(no_mangle)]
70pub unsafe extern "C" fn wasmtime_linker_define_func(
71 linker: &mut wasmtime_linker_t,
72 module: *const u8,
73 module_len: usize,
74 name: *const u8,
75 name_len: usize,
76 ty: &wasm_functype_t,
77 callback: crate::wasmtime_func_callback_t,
78 data: *mut c_void,
79 finalizer: Option<extern "C" fn(*mut std::ffi::c_void)>,
80) -> Option<Box<wasmtime_error_t>> {
81 let ty = ty.ty().ty(linker.linker.engine());
82 let module = to_str!(module, module_len);
83 let name = to_str!(name, name_len);
84 let cb = crate::func::c_callback_to_rust_fn(callback, data, finalizer);
85 handle_result(linker.linker.func_new(module, name, ty, cb), |_linker| ())
86}
87
88#[unsafe(no_mangle)]
89pub unsafe extern "C" fn wasmtime_linker_define_func_unchecked(

Callers 1

func_newMethod · 0.85

Calls 5

c_callback_to_rust_fnFunction · 0.85
handle_resultFunction · 0.85
tyMethod · 0.45
engineMethod · 0.45
func_newMethod · 0.45

Tested by

no test coverage detected