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

Function wasmtime_linker_get

crates/c-api/src/linker.rs:188–213  ·  view source on GitHub ↗
(
    linker: &wasmtime_linker_t,
    store: WasmtimeStoreContextMut<'_>,
    module: *const u8,
    module_len: usize,
    name: *const u8,
    name_len: usize,
    item_ptr: &mut MaybeUninit<wasmtim

Source from the content-addressed store, hash-verified

186
187#[unsafe(no_mangle)]
188pub unsafe extern "C" fn wasmtime_linker_get(
189 linker: &wasmtime_linker_t,
190 store: WasmtimeStoreContextMut<'_>,
191 module: *const u8,
192 module_len: usize,
193 name: *const u8,
194 name_len: usize,
195 item_ptr: &mut MaybeUninit<wasmtime_extern_t>,
196) -> bool {
197 let linker = &linker.linker;
198 let module = match str::from_utf8(crate::slice_from_raw_parts(module, module_len)) {
199 Ok(s) => s,
200 Err(_) => return false,
201 };
202 let name = match str::from_utf8(crate::slice_from_raw_parts(name, name_len)) {
203 Ok(s) => s,
204 Err(_) => return false,
205 };
206 match linker.get(store, module, name) {
207 Ok(which) => {
208 crate::initialize(item_ptr, which.into());
209 true
210 }
211 Err(_) => false,
212 }
213}
214
215#[unsafe(no_mangle)]
216pub unsafe extern "C" fn wasmtime_linker_define_unknown_imports_as_traps(

Callers 1

getMethod · 0.85

Calls 3

slice_from_raw_partsFunction · 0.85
initializeFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected