| 72 | |
| 73 | #[unsafe(no_mangle)] |
| 74 | pub unsafe extern "C" fn wasmtime_instance_new( |
| 75 | store: WasmtimeStoreContextMut<'_>, |
| 76 | module: &wasmtime_module_t, |
| 77 | imports: *const wasmtime_extern_t, |
| 78 | nimports: usize, |
| 79 | instance: &mut Instance, |
| 80 | trap_ptr: &mut *mut wasm_trap_t, |
| 81 | ) -> Option<Box<wasmtime_error_t>> { |
| 82 | let imports = crate::slice_from_raw_parts(imports, nimports) |
| 83 | .iter() |
| 84 | .map(|i| i.to_extern()) |
| 85 | .collect::<Vec<_>>(); |
| 86 | handle_instantiate( |
| 87 | Instance::new(store, &module.module, &imports), |
| 88 | instance, |
| 89 | trap_ptr, |
| 90 | ) |
| 91 | } |
| 92 | |
| 93 | pub(crate) fn handle_instantiate( |
| 94 | instance: wasmtime::Result<Instance>, |