diff --git a/ecsact/wasm.h b/ecsact/wasm.h index 0aa2d34..6ce7727 100644 --- a/ecsact/wasm.h +++ b/ecsact/wasm.h @@ -95,6 +95,12 @@ typedef enum ecsactsi_wasm_error { * Invoking `_initialize()` resulted in a wasm trap */ ECSACTSI_WASM_ERR_INITIALIZE_FAIL, + + /** + * Ecsact dynamic module is 'load at runtime' but + * 'ecsact_set_system_execution_impl' has not been set. + */ + ECSACTSI_WASM_ERR_NO_SET_SYSTEM_EXECUTION, } ecsactsi_wasm_error; ECSACTSI_WASM_API_FN(void, ecsactsi_wasm_last_error_message) diff --git a/ecsact/wasm/detail/wasm.cc b/ecsact/wasm/detail/wasm.cc index c3de878..4e92342 100644 --- a/ecsact/wasm/detail/wasm.cc +++ b/ecsact/wasm/detail/wasm.cc @@ -121,6 +121,12 @@ ecsactsi_wasm_error ecsactsi_wasm_load( using ecsact::wasm::detail::minst_error_code; using ecsact::wasm::detail::minst_export; +#ifdef ECSACT_DYNAMIC_API_LOAD_AT_RUNTIME + if(ecsact_set_system_execution_impl == nullptr) { + return ECSACTSI_WASM_ERR_NO_SET_SYSTEM_EXECUTION; + } +#endif + auto result = ecsact::wasm::detail::minst::create( engine(), std::span{