Skip to main content

WasmEdge_ExecutorRegisterImport

Function WasmEdge_ExecutorRegisterImport 

Source
pub unsafe extern "C" fn WasmEdge_ExecutorRegisterImport(
    Cxt: *mut WasmEdge_ExecutorContext,
    StoreCxt: *mut WasmEdge_StoreContext,
    ImportCxt: *const WasmEdge_ModuleInstanceContext,
) -> WasmEdge_Result
Expand description

Register a module instance in a store by exporting its module name.

Register an existing module into the store with its module name. After calling this function, the existing module instance will be registered into the store, and the other modules can import the exported instances for linking during instantiation. Developers SHOULD guarantee the lifetime of this existing module instance, or an error will occur during execution after the module instance is destroyed if it has been imported by other modules. When the module instance is deleted, it will be unregistered from the store automatically.

\param Cxt the WasmEdge_ExecutorContext to instantiate the module. \param StoreCxt the WasmEdge_StoreContext to store the instantiated module. \param ImportCxt the WasmEdge_ModuleInstanceContext to register.

\returns WasmEdge_Result. Call WasmEdge_ResultGetMessage for the error message.