From 5f87ea3bbf9ec9b0467553c228c4a2093027ccda Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 2 Jun 2010 21:24:40 -0400 Subject: [PATCH] Let dlfcn.h return a function pointer on Windows --- lib/roken/dlfcn.h | 4 ++++ lib/roken/dlfcn_w32.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/roken/dlfcn.h b/lib/roken/dlfcn.h index d0972573d..bca8cb054 100644 --- a/lib/roken/dlfcn.h +++ b/lib/roken/dlfcn.h @@ -42,7 +42,11 @@ #endif #endif +#ifdef _WIN32 +typedef int (__stdcall *DLSYM_RET_TYPE)(); +#else #define DLSYM_RET_TYPE void * +#endif #ifdef __cplusplus extern "C" diff --git a/lib/roken/dlfcn_w32.c b/lib/roken/dlfcn_w32.c index 713887330..08005f70c 100644 --- a/lib/roken/dlfcn_w32.c +++ b/lib/roken/dlfcn_w32.c @@ -91,6 +91,6 @@ dlsym(void * vhm, const char * func_name) { HMODULE hm = (HMODULE) vhm; - return GetProcAddress(hm, func_name); + return (DLSYM_RET_TYPE)(ULONG_PTR)GetProcAddress(hm, func_name); }