diff options
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/glew/README.chromium | 7 | ||||
-rw-r--r-- | third_party/glew/src/glew.c | 19 |
2 files changed, 9 insertions, 17 deletions
diff --git a/third_party/glew/README.chromium b/third_party/glew/README.chromium index d04bb69..4d554c8 100644 --- a/third_party/glew/README.chromium +++ b/third_party/glew/README.chromium @@ -1,7 +1,10 @@ This is Chrome's local copy of the GLEW library, which is currently used to interface to OpenGL and extensions to implement the WebGL -specification. It is currently unmodified from the original -distribution. +specification. + +Compared to the original distribution, the implementation of +NSGLGetProcAddress has been changed to use the standard dlfcn.h +functions rather than the deprecated mach-o/dyld.h ones. Originally obtained from http://glew.sourceforge.net/ . The LICENSE.txt from that distribution has been preserved here. diff --git a/third_party/glew/src/glew.c b/third_party/glew/src/glew.c index 24c6a72..bbdc99c 100644 --- a/third_party/glew/src/glew.c +++ b/third_party/glew/src/glew.c @@ -66,29 +66,18 @@ #endif /* GLEW_MX */ #if defined(__APPLE__) -#include <mach-o/dyld.h> +#include <dlfcn.h> #include <stdlib.h> #include <string.h> void* NSGLGetProcAddress (const GLubyte *name) { - static const struct mach_header* image = NULL; - NSSymbol symbol; - char* symbolName; + static void* image = NULL; if (NULL == image) { - image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR); + image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY | RTLD_LOCAL); } - /* prepend a '_' for the Unix C symbol mangling convention */ - symbolName = malloc(strlen((const char*)name) + 2); - strcpy(symbolName+1, (const char*)name); - symbolName[0] = '_'; - symbol = NULL; - /* if (NSIsSymbolNameDefined(symbolName)) - symbol = NSLookupAndBindSymbol(symbolName); */ - symbol = image ? NSLookupSymbolInImage(image, symbolName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : NULL; - free(symbolName); - return symbol ? NSAddressOfSymbol(symbol) : NULL; + return image ? dlsym(image, (const char*) name) : NULL; } #endif /* __APPLE__ */ |