pub unsafe extern "C" fn WasmEdge_VMGetImportModuleContext(
    Cxt: *const WasmEdge_VMContext,
    Reg: WasmEdge_HostRegistration
) -> *mut WasmEdge_ModuleInstanceContext
Expand description

Get the module instance corresponding to the WasmEdge_HostRegistration settings.

When creating the VM context with a configuration, the built-in host module will be registered according to the WasmEdge_HostRegistration settings added into the WasmEdge_ConfigureContext. You can call this function to get the WasmEdge_ModuleInstanceContext corresponding to the settings. The module instance context links to the context owned by the VM context. The caller should NOT call the WasmEdge_ModuleInstanceDelete.

WasmEdge_ConfigureContext *Conf = WasmEdge_ConfigureCreate();
WasmEdge_ConfigureAddHostRegistration(Conf, WasmEdge_HostRegistration_Wasi);
WasmEdge_VMContext *VM = WasmEdge_VMCreate(Conf, NULL);
WasmEdge_ModuleInstanceContext *WasiMod =
    WasmEdge_VMGetImportModuleContext(VM, WasmEdge_HostRegistration_Wasi);

This function is thread-safe.

\param Cxt the WasmEdge_VMContext. \param Reg the host registration value to get the import module.

\returns pointer to the module instance context. NULL if not found.