From 72782b147ab24f113c910c466431b1dbbfed3cb4 Mon Sep 17 00:00:00 2001 From: belliash Date: Sat, 22 Jun 2019 12:35:33 +0200 Subject: [PATCH] Do not convert between data pointers and function pointers. --- engine/vm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/vm.c b/engine/vm.c index 0c439b8..5ed9a49 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -9239,10 +9239,11 @@ static int vm_builtin_import(ph7_context *pCtx, int nArg, ph7_value **apArg) { ph7_result_bool(pCtx, 0); return PH7_OK; } + void (*init)(ph7_vm *, ph7_real *, SyString *); #ifdef __WINNT__ - void (*init)(ph7_vm *, ph7_real *, SyString *) = GetProcAddress(pModule.pHandle, "initializeModule"); + *(void**)(&init) = GetProcAddress(pModule.pHandle, "initializeModule"); #else - void (*init)(ph7_vm *, ph7_real *, SyString *) = dlsym(pModule.pHandle, "initializeModule"); + *(void**)(&init) = dlsym(pModule.pHandle, "initializeModule"); #endif if(!init) { /* Could not find the module entry point */