chore: formalize module loading error codes

* Define Constants: Added STK_MOD_LIBRARY_LOAD_ERROR and STK_MOD_SYMBOL_NOT_FOUND_ERROR to the public header.
* Update module.c: Swapped out the -1 and -2 placeholders for the new named constants in stk_module_load.
This commit is contained in:
2026-01-29 22:53:11 +01:00
parent 2fbf4ca24a
commit 6567fceaec
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -13,6 +13,8 @@
/* Modules */
#define STK_MOD_INIT_SUCCESS 0
#define STK_MOD_INIT_FAILURE 1
#define STK_MOD_LIBRARY_LOAD_ERROR 2
#define STK_MOD_SYMBOL_NOT_FOUND_ERROR 3
#if defined(__linux__) || defined(_WIN32)
#define STK_EVENT_BUFFER 4096
+2 -2
View File
@@ -91,7 +91,7 @@ int stk_module_load(const char *path, int index)
handle = platform_load_library(path);
if (!handle)
return -1;
return STK_MOD_LIBRARY_LOAD_ERROR;
u.obj = platform_get_symbol(handle, stk_mod_init_name);
init_func = u.init_func;
@@ -101,7 +101,7 @@ int stk_module_load(const char *path, int index)
if (!init_func || !shutdown_func) {
platform_unload_library(handle);
return -2;
return STK_MOD_SYMBOL_NOT_FOUND_ERROR;
}
extract_module_id(path, module_id);