The originally implementation here had a whitelist of function names for
which we would return a wrapped symbol, (a very short whitelist consisting
only of "glXSwapBuffers"). A hard-coded list here would be a maintenance
nightmare.
Instead, we now simply perform a dlsym lookup on the wrapper library itself
and if there's a function that exists in the library matching the name
being requested, we return that.
This way we can add functions to our wrapper library without needing to
change the implementation of glXGetProcAddressARB at all.
__GLXextFuncPtr
glXGetProcAddressARB (const GLubyte *func)
{
+ __GLXextFuncPtr ptr;
static fips_glXGetProcAddressARB_t real_glXGetProcAddressARB = NULL;
const char *name = "glXGetProcAddressARB";
}
}
- if (strcmp ((const char *)func, "glXSwapBuffers") == 0)
- return (__GLXextFuncPtr) glXSwapBuffers;
- else
- return real_glXGetProcAddressARB (func);
+ /* If our library has this symbol, that's what we want to give. */
+ ptr = dlwrap_real_dlsym (NULL, (const char *) func);
+ if (ptr)
+ return ptr;
+
+ /* Otherwise, just defer to the real glXGetProcAddressARB. */
+ return real_glXGetProcAddressARB (func);
}