fix: sync module types and replace WIP constants
* Types: Corrected stk.c to use stk_init_mod_func and stk_shutdown_mod_func instead of generic types. * Errors: Replaced -3 placeholder with STK_MOD_INIT_FAILURE. * Cleanup: Moved typedefs in module.c for consistency.
This commit is contained in:
+4
-4
@@ -11,13 +11,13 @@
|
|||||||
#define STK_PATH_SEP '/'
|
#define STK_PATH_SEP '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef int (*stk_init_mod_func)(void);
|
||||||
|
typedef void (*stk_shutdown_mod_func)(void);
|
||||||
|
|
||||||
void *platform_load_library(const char *path);
|
void *platform_load_library(const char *path);
|
||||||
void platform_unload_library(void *handle);
|
void platform_unload_library(void *handle);
|
||||||
void *platform_get_symbol(void *handle, const char *symbol);
|
void *platform_get_symbol(void *handle, const char *symbol);
|
||||||
|
|
||||||
typedef int (*stk_init_mod_func)(void);
|
|
||||||
typedef void (*stk_shutdown_mod_func)(void);
|
|
||||||
|
|
||||||
char (*stk_module_ids)[STK_MOD_ID_BUFFER] = NULL;
|
char (*stk_module_ids)[STK_MOD_ID_BUFFER] = NULL;
|
||||||
void **stk_handles = NULL;
|
void **stk_handles = NULL;
|
||||||
stk_init_mod_func *stk_inits = NULL;
|
stk_init_mod_func *stk_inits = NULL;
|
||||||
@@ -108,7 +108,7 @@ int stk_module_load(const char *path, int index)
|
|||||||
|
|
||||||
if (init_func() != STK_MOD_INIT_SUCCESS) {
|
if (init_func() != STK_MOD_INIT_SUCCESS) {
|
||||||
platform_unload_library(handle);
|
platform_unload_library(handle);
|
||||||
return -3;
|
return STK_MOD_INIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(stk_module_ids[index], module_id, STK_MOD_ID_BUFFER - 1);
|
strncpy(stk_module_ids[index], module_id, STK_MOD_ID_BUFFER - 1);
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
typedef void (*stk_module_func)(void);
|
typedef int (*stk_init_mod_func)(void);
|
||||||
|
typedef void (*stk_shutdown_mod_func)(void);
|
||||||
|
|
||||||
extern void **stk_handles;
|
extern void **stk_handles;
|
||||||
extern stk_module_func *stk_inits;
|
extern stk_init_mod_func *stk_inits;
|
||||||
extern stk_module_func *stk_shutdowns;
|
extern stk_shutdown_mod_func *stk_shutdowns;
|
||||||
extern char (*stk_module_ids)[STK_MOD_ID_BUFFER];
|
extern char (*stk_module_ids)[STK_MOD_ID_BUFFER];
|
||||||
|
|
||||||
extern size_t module_count;
|
extern size_t module_count;
|
||||||
|
|||||||
Reference in New Issue
Block a user