From 42cf58112599c53e681a628ab936276f125d3c67 Mon Sep 17 00:00:00 2001 From: anth64 Date: Mon, 19 Jan 2026 07:57:40 +0100 Subject: [PATCH] fix: use union for ISO C compliant function pointer conversion --- src/module.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/module.c b/src/module.c index b538d5e..95404de 100644 --- a/src/module.c +++ b/src/module.c @@ -99,15 +99,20 @@ int stk_module_load(const char *path, int index) const char *basename; char *dot; char module_id[STK_MOD_ID_BUFFER]; + union { + void *obj; + stk_module_func func; + } u; handle = platform_load_library(path); if (!handle) return -1; - init_func = - (stk_module_func)platform_get_symbol(handle, "stk_module_init"); - shutdown_func = - (stk_module_func)platform_get_symbol(handle, "stk_module_shutdown"); + u.obj = platform_get_symbol(handle, "stk_module_init"); + init_func = u.func; + + u.obj = platform_get_symbol(handle, "stk_module_shutdown"); + shutdown_func = u.func; if (!init_func || !shutdown_func) { platform_unload_library(handle);