+void
+(*glXGetProcAddress (const unsigned char *name))(void);
+
+void
+(*glXGetProcAddress (const unsigned char *name))(void)
+{
+ static int first_call = 1;
+ static typeof (&glXGetProcAddress) wrapper_glXGetProcAddress;
+ static typeof (&glXGetProcAddress) libgl_glXGetProcAddress;
+ void *symbol;
+
+ /* On the first call, check if the wrapper provides an
+ * implementation of this function. */
+ if (first_call) {
+ wrapper_glXGetProcAddress =
+ find_symbol_in_glaze_wrappers ("glXGetProcAddress");
+ libgl_glXGetProcAddress = dlsym (libgl_handle,
+ "glXGetProcAddress");
+ first_call = 0;
+ }
+
+ /* If the wrapper implements glXGetProcAddress itself, then it
+ * had better know best what to do. Just let it. */
+ if (wrapper_glXGetProcAddress)
+ return wrapper_glXGetProcAddress (name);
+
+ /* Otherwise, we need to resolve the name.
+ *
+ * The wrappers get first choice on all symbols. */
+ symbol = find_symbol_in_glaze_wrappers ((char *) name);
+ if (symbol)
+ return symbol;
+
+ /* The wrapper doesn't care, so defer to the underlying
+ * glXGetProcAddress */
+ return libgl_glXGetProcAddress (name);
+
+}
+
+void
+(*glXGetProcAddressARB (const unsigned char *name))(void);
+
+void
+(*glXGetProcAddressARB (const unsigned char *name))(void)
+{
+ static int first_call = 1;
+ static typeof (&glXGetProcAddressARB) wrapper_glXGetProcAddressARB;
+ static typeof (&glXGetProcAddressARB) libgl_glXGetProcAddressARB;
+ void *symbol;
+
+ /* On the first call, check if the wrapper provides an
+ * implementation of this function. */
+ if (first_call) {
+ wrapper_glXGetProcAddressARB =
+ find_symbol_in_glaze_wrappers ("glXGetProcAddressARB");
+ libgl_glXGetProcAddressARB = dlsym (libgl_handle,
+ "glXGetProcAddressARB");
+ first_call = 0;
+ }
+
+ /* If the wrapper implements glXGetProcAddressARB itself, then
+ * it had better know best what to do. Just let it. */
+ if (wrapper_glXGetProcAddressARB)
+ return wrapper_glXGetProcAddressARB (name);
+
+ /* Otherwise, we need to resolve the name.
+ *
+ * The wrappers get first choice on all symbols. */
+ symbol = find_symbol_in_glaze_wrappers ((char *) name);
+ if (symbol)
+ return symbol;
+
+ /* The wrapper doesn't care, so defer to the underlying
+ * glXGetProcAddressARB */
+ return libgl_glXGetProcAddressARB (name);
+
+}
+