(
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,
| 68 | |
| 69 | #[unsafe(no_mangle)] |
| 70 | pub 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)] |
| 89 | pub unsafe extern "C" fn wasmtime_linker_define_func_unchecked( |
no test coverage detected