Skip to content

Commit

Permalink
fix: check for unavailable dynamic methods
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Oct 17, 2024
1 parent 636b34b commit b2b593d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ecsact/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions ecsact/wasm/detail/wasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit b2b593d

Please sign in to comment.