+/**
+ * Wrapper for dlsym() that does a cast to a generic function type,
+ * rather than a void *. This reduces the number of warnings that are
+ * generated.
+ */
+static inline GenericFunc
+_mesa_dlsym(void *handle, const char *fname)
+{
+ union {
+ void *v;
+ GenericFunc f;
+ } u;
+#if defined(__blrts)
+ u.v = NULL;
+#elif defined(__DJGPP__)
+ /* need '_' prefix on symbol names */
+ char fname2[1000];
+ fname2[0] = '_';
+ strncpy(fname2 + 1, fname, 998);
+ fname2[999] = 0;
+ u.v = dlsym(handle, fname2);
+#elif defined(HAVE_DLOPEN)
+ u.v = dlsym(handle, fname);
+#elif defined(__MINGW32__)
+ u.v = (void *) GetProcAddress(handle, fname);
+#else
+ u.v = NULL;
+#endif
+ return u.f;
+}