-
-/*
- * Handle to the true libGL.so
- */
-static void *libgl_handle = NULL;
-
-
-/*
- * Lookup a libGL symbol
- */
-static void * __dlsym(const char *symbol)
-{
- void *result;
- if (!libgl_handle) {
- const char * libgl_filename;
-
- /*
- * Unfortunately we can't just dlopen
- * /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib
- * because DYLD_LIBRARY_PATH takes precedence, even for absolute paths.
- */
- libgl_filename = "libGL.system.dylib";
-
- libgl_handle = dlopen(libgl_filename, RTLD_LOCAL | RTLD_NOW | RTLD_FIRST);
- if (!libgl_handle) {
- OS::DebugMessage("error: couldn't load %s\n", libgl_filename);
- return NULL;
- }
- }
-
- result = dlsym(libgl_handle, symbol);
-
- if (result == dlsym(RTLD_SELF, symbol)) {
- OS::DebugMessage("error: symbol lookup recursion\n");
- OS::Abort();
- return NULL;
- }
-
- return result;
-}
-
-