+static void
+open_wrapper_handle (void)
+{
+ const char *path;
+
+ if (wrapper_handle)
+ return;
+
+ path = getenv ("GLAZE_WRAPPER");
+ if (path == NULL) {
+ fprintf (stderr, "GLAZE_WRAPPER unset. Please set to path of real libGL.so under glaze.\n");
+ exit (1);
+ }
+
+ wrapper_handle = dlopen (path, RTLD_LAZY);
+ if (wrapper_handle == NULL) {
+ fprintf (stderr, "Error: Failed to dlopen %s\n", path);
+ exit (1);
+ }
+}
+