]> granicus.if.org Git - curl/commitdiff
Joe Halpin fixed the warning on the typecast from data pointer to function
authorDaniel Stenberg <daniel@haxx.se>
Wed, 5 May 2004 14:08:52 +0000 (14:08 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 5 May 2004 14:08:52 +0000 (14:08 +0000)
pointer!

lib/ldap.c

index 223c3fb556f5d6fad5f6e9a8245dc8210d6f78e2..7323788cf6e85e119a1966aab760a2af17341fcb 100644 (file)
@@ -164,7 +164,11 @@ static dynafunc DynaGetFunction(const char *name)
 
 #if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
   if (libldap) {
-    func = (dynafunc)dlsym(libldap, name);
+    /* This typecast magic below was brought by Joe Halpin. In ISO C, you
+     * cannot typecast a data pointer to a function pointer, but that's
+     * exactly what we need to do here to avoid compiler warnings on picky
+     * compilers! */
+    *(void**) (&func) = dlsym(libldap, name);
   }
 #elif defined(WIN32)
   if (libldap) {