-
-static void
-glaze_init (void) __attribute__((constructor));
-
-static void
-glaze_init (void)
-{
- open_libgl_handle ();
- open_wrapper_handle ();
-}
-
-static void *
-resolve (const char *name)
-{
- void *symbol;
-
- /* The wrapper gets first choice on all symbols. */
- symbol = dlsym (wrapper_handle, name);
- if (symbol)
- return symbol;
-
- return dlsym (libgl_handle, name);
-}
-
-#define GLAZE_API(name) \
-void * name() __attribute__((ifunc(#name "_resolver"))); \
-static void * \
-name ## _resolver (void) { return resolve (#name); }
-
-#include "specs/gl.def"
-#include "specs/glx.def"