mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-27 03:10:54 +00:00
Changed: #1004 - implemented nglGetProcAddress using dlsym
This commit is contained in:
parent
9c73a06e1b
commit
7f007d2cc1
1 changed files with 18 additions and 10 deletions
|
@ -30,20 +30,28 @@ using namespace NLMISC;
|
|||
#ifdef NL_OS_WINDOWS
|
||||
#define nglGetProcAddress wglGetProcAddress
|
||||
#elif defined(NL_OS_MAC)
|
||||
#include <mach-o/dyld.h>
|
||||
// #include <mach-o/dyld.h>
|
||||
// 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 <dlfcn.h>
|
||||
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))()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue