- Consolidate handles, function pointers, metadata, and deps into single stk_mod_t
- Remove all separate metadata arrays and index mappings
- Simplify init, free, realloc, load, and unload significantly
- stk.c externs reduced to stk_modules and module_count
- Add tight-packed arrays with index mappings for name, version, and description
- Resolve optional metadata symbols at load time via platform_get_symbol
- Add setter functions for metadata symbol name overrides
- Replace stk_initialized with stk_flags bitfield
- Add STK_FLAG_INITIALIZED (0x01) and STK_FLAG_LOGGING_ENABLED (0x02)
- Add stk_set_logging_enabled() and stk_is_logging_enabled() API
- Single byte for all boolean state and settings
Logging enabled by default, packs all flags into one byte for efficiency.
BREAKING CHANGE: Public API now uses unsigned char instead of uint8_t
- Remove stdint.h dependency (C99 feature, not C89, I am a fucking idiot)
- Replace uint8_t with unsigned char throughout codebase
- Affects stk_init() return type and internal functions
- Corrects unintended C99 dependency, restoring intended C89 compliance
- In stk_module_load: Use memcpy with explicit length check instead of strncpy
- In platform_directory_init_scan: Same fix for directory scanning
- In stk_module_realloc_memory: Replace realloc with malloc+memcpy approach
to avoid potential use-after-free issues and compiler warnings
- All changes maintain same functionality with improved safety
- Update module load and memory functions to use fixed-width uint8_t
- Implement STK_MOD_REALLOC_FAILURE for granular memory error tracking
- Clean up logging prefixes in stk_poll for consistency
- Update error string helper to support new module error codes
On Windows, module IDs were failing to load because paths were being
constructed with hardcoded forward slashes. Oops...
- Added platform.h to centralize path separator macros.
- Updated build_path in stk.c to use STK_PATH_SEP_STR instead of "/".
- Cleaned up redundant platform logic in module.c.
* 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.
* 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.
* Add STK_MOD_INIT_SUCCESS and STK_MOD_INIT_FAILURE macros to stk.h.
* Update stk_module_load to validate module initialization before finalizing the load.
* Unload library if the init func fails, return error.
* Define stk_init_mod_func as int (*)(void) and stk_shutdown_mod_func as void (*)(void).
* Update stk_inits and stk_shutdowns arrays to use the new specific function pointer types.
* Update the symbol lookup union in stk_module_load to support distinct init and shutdown signatures.
* Adjust memory allocation and reallocation logic in stk_module_init_memory and stk_module_realloc_memory to match new type sizes.
- Define STK_PATH_SEP macro to handle Windows and Unix path separators.
- Refactor extract_module_id to use STK_PATH_SEP.
- Simplify stk_module_load by delegating module ID extraction to extract_module_id.
* Set all module slot fields (handle, init, shutdown, id) to NULL/empty
after unloading to prevent use-after-free and enable proper hole
detection during array defragmentation.
* Implement stk_module_realloc_memory() to grow or shrink module arrays during hot-reload operations.
* All-or-nothing strategy with fallback to original pointers on partial realloc failure.
Replace the placeholder TODO logs in the polling loop with logic to
resolve filesystem events into specific module indices.
- Centralizing State: Refactored is_module_loaded to is_mod_loaded to
check against the global stk_module_ids array, removing the need to
pass local buffers and preparing for unified lifetime management.
- Standardizing Identity: Updated extract_module_id to use a
consistent output buffer.
- Categorized Event Processing: Implemented a two-pass approach in
stk_poll to count event types (LOAD, UNLOAD, RELOAD) and allocate
tracking arrays, replacing the previous stubbed switch statement.
- Mapping Events to Indices: The poll loop now resolves filenames
back to their specific loaded indices via is_mod_loaded to
identify exactly which mod_id and index require action.
- Improved Flow Control: Introduced a finish_stk_poll label to
ensure consistent cleanup and return values when no events are
detected or processing is complete.
* Introduced stk_initialized flag.
* Updated all configuration setters (stk_set_mod_dir, stk_set_tmp_dir_name, stk_set_module_init_fn, and stk_set_module_shutdown_fn) to silently return if the library is already initialized.
* Ensures internal state consistency by locking paths and function entry points once stk_init has been called.
* Added functions to set mod dir, temp dir name, and module init/shutdown function names.
* Replaced hardcoded string literals with configurable static buffers in module.c.
* Improved string safety by replacing sprintf with strncpy/strncat.
* Updated stk_init local path buffers to handle maximum combined path lengths.
- Move extract_module_id and is_valid_module_file to module.c
- Update is_module_loaded to return module index instead of uint8_t
- Fix platform.c event checks to handle index-based return (>= 0)
- Centralize STK_MODULE_EXT definitions in stk.h
- Use fixed STK_PATH_MAX and STK_MOD_ID_BUFFER throughout for predictable memory
- Filter by platform-specific extensions (.so/.dll/.dylib) with compile-time length
- Add RELOAD event detection and is_module_loaded() helper
- Maintain feature parity across all platforms
- Add stk_module_ids array to track module IDs by filename.
- extract_module_id() extracts module ID from it's filename.
- Enables tracking of file changes of already loaded modules.