Fixed warning about casts between function pointers
gcc now warns (with -Wextra) about casts between pointers to different
function types. The type 'void(*)(void)' works as a 'void*' for function
pointers, cleaning the warning.
diff --git a/loadlib.c b/loadlib.c
index 9d86b15..ddfecca 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -68,6 +68,13 @@
/*
+** Special type equivalent to '(void*)' for functions in gcc
+** (to supress warnings when converting function pointers)
+*/
+typedef void (*voidf)(void);
+
+
+/*
** system-dependent functions
*/
@@ -206,7 +213,7 @@
static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) {
- lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym);
+ lua_CFunction f = (lua_CFunction)(voidf)GetProcAddress((HMODULE)lib, sym);
if (f == NULL) pusherror(L);
return f;
}