- const char *libgl_filename = "libGL.so.1";
- static void *libgl_handle = NULL;
-
- if (! libgl_handle) {
- libgl_handle = dlwrap_real_dlopen (libgl_filename, RTLD_NOW | RTLD_DEEPBIND);
- if (! libgl_handle) {
- fprintf (stderr, "Error: Failed to dlopen %s\n",
- libgl_filename);
- exit (1);
- }
- }
-
- return dlwrap_real_dlsym (libgl_handle, name);
+ static void *libfips_handle = NULL;
+ void *ret;
+
+ if (libfips_handle == NULL)
+ libfips_handle = dlwrap_dlopen_libfips ();
+
+ /* If our library has this symbol, that's what we want to give. */
+ ret = dlwrap_real_dlsym (libfips_handle, (const char *) func);
+ if (ret)
+ return ret;
+
+ /* Otherwise, just defer to the real glXGetProcAddressARB. */
+ GLWRAP_DEFER_WITH_RETURN (ret, glXGetProcAddressARB, func);
+
+ return ret;