pub unsafe extern "C" fn WasmEdge_ExecutorRegister(
    Cxt: *mut WasmEdge_ExecutorContext,
    ModuleCxt: *mut *mut WasmEdge_ModuleInstanceContext,
    StoreCxt: *mut WasmEdge_StoreContext,
    ASTCxt: *const WasmEdge_ASTModuleContext,
    ModuleName: WasmEdge_String
) -> WasmEdge_Result
Expand description

Instantiate an AST Module into a named module instance and link into store.

Instantiate an AST Module with the module name, return the instantiated module instance context as the result, and also register the module instance to the store. The caller owns the object and should call WasmEdge_ModuleInstanceDelete to destroy it. Developers can use the WasmEdge_ModuleInstanceListFunction, WasmEdge_ModuleInstanceFindFunction, etc. APIs to retrieve the exported instances from the result module instance. After calling this function, the output module instance will also be registered into the store, and the other modules can import the exported instances for linking when instantiation. Developers SHOULD guarantee the life cycle of this output module instance, or the error will occur when in execution after the module instance being destroyed if it has been imported by other modules. That is, developers have the responsibility to delete the output module instance even though the store being destroyed. When the module instance is deleted, it will be unregistered to the store automatically.

\param Cxt the WasmEdge_ExecutorContext to instantiate the module. \param [out] ModuleCxt the output WasmEdge_ModuleInstanceContext if succeeded. \param StoreCxt the WasmEdge_StoreContext to link the imports. \param ASTCxt the WasmEdge AST Module context generated by loader or compiler. \param ModuleName the module name WasmEdge_String for all exported instances.

\returns WasmEdge_Result. Call WasmEdge_ResultGetMessage for the error message.