From 3c91fe67ef4250eed32d457e1aaf443c011e65cf Mon Sep 17 00:00:00 2001 From: rti Date: Wed, 4 Aug 2010 20:33:52 +0200 Subject: [PATCH] Changed: #1004 - implemented nglGetProcAddress using dlsym --- .../driver/opengl/driver_opengl_extension.cpp | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 3c9e372d8..3c775a9a2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -30,20 +30,28 @@ using namespace NLMISC; #ifdef NL_OS_WINDOWS #define nglGetProcAddress wglGetProcAddress #elif defined(NL_OS_MAC) -#include +// #include // glXGetProcAddressARB doesn't work correctly on MAC +// void *nglGetProcAddress(const char *name) +// { +// NSSymbol symbol; +// char *symbolName; +// symbolName = (char*)malloc (strlen (name) + 2); +// strcpy(symbolName + 1, name); +// symbolName[0] = '_'; +// symbol = NULL; +// if (NSIsSymbolNameDefined (symbolName)) symbol = NSLookupAndBindSymbol (symbolName); +// free (symbolName); +// return symbol ? NSAddressOfSymbol (symbol) : NULL; +// } + +// NSAddressOfSymbol, NSIsSymbolNameDefined, NSLookupAndBindSymbol are deprecated +#include void *nglGetProcAddress(const char *name) { - NSSymbol symbol; - char *symbolName; - symbolName = (char*)malloc (strlen (name) + 2); - strcpy(symbolName + 1, name); - symbolName[0] = '_'; - symbol = NULL; - if (NSIsSymbolNameDefined (symbolName)) symbol = NSLookupAndBindSymbol (symbolName); - free (symbolName); - return symbol ? NSAddressOfSymbol (symbol) : NULL; + return dlsym(RTLD_DEFAULT, name); } + #elif defined (NL_OS_UNIX) void (*nglGetProcAddress(const char *procName))() {