summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-10-30 14:43:54 +0000
committerDavid Robillard <d@drobilla.net>2013-10-30 14:43:54 +0000
commit40ec4d79702be71525994d23e4a2d950ce945b75 (patch)
treee16bc30cc8c0d61733f6dbac886f1f58ac3aa1df /src
parent9b855e16294bedda04a82308f48bbefb6fc5f70d (diff)
downloadlilv-40ec4d79702be71525994d23e4a2d950ce945b75.tar.gz
lilv-40ec4d79702be71525994d23e4a2d950ce945b75.tar.bz2
lilv-40ec4d79702be71525994d23e4a2d950ce945b75.zip
Call GetProcAddress with correct calling convention on Windows (fix #932).
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5164 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/lilv_internal.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lilv_internal.h b/src/lilv_internal.h
index 95bcee7..502d214 100644
--- a/src/lilv_internal.h
+++ b/src/lilv_internal.h
@@ -30,7 +30,6 @@ extern "C" {
# include <windows.h>
# define dlopen(path, flags) LoadLibrary(path)
# define dlclose(lib) FreeLibrary((HMODULE)lib)
-# define dlsym GetProcAddress
# ifdef _MSC_VER
# define __func__ __FUNCTION__
# define INFINITY DBL_MAX + DBL_MAX
@@ -358,15 +357,19 @@ lilv_dir_for_each(const char* path,
void* data,
void (*f)(const char* path, const char* name, void* data));
-typedef void (*VoidFunc)(void);
+typedef void (*LilvVoidFunc)(void);
/** dlsym wrapper to return a function pointer (without annoying warning) */
-static inline VoidFunc
+static inline LilvVoidFunc
lilv_dlfunc(void* handle, const char* symbol)
{
- typedef VoidFunc (*VoidFuncGetter)(void*, const char*);
+#ifdef _WIN32
+ return (LilvVoidFunc)GetProcAddress((HMODULE)handle, symbol);
+#else
+ typedef LilvVoidFunc (*VoidFuncGetter)(void*, const char*);
VoidFuncGetter dlfunc = (VoidFuncGetter)dlsym;
return dlfunc(handle, symbol);
+#endif
}
#ifdef LILV_DYN_MANIFEST