leocad/macosx/osx_gl.cpp
2011-09-07 21:06:51 +00:00

34 lines
680 B
C++
Executable file

#include <mach-o/dyld.h>
#include <stdlib.h>
#include <string.h>
bool Sys_GLOpenLibrary(const char* LibName)
{
return true;
}
void Sys_GLCloseLibrary()
{
}
void* Sys_GLGetProc(const char* ProcName)
{
NSSymbol Symbol = NULL;
char* SymbolName;
// Prepend a '_' for the Unix C symbol mangling convention.
SymbolName = (char*)malloc(strlen(ProcName) + 2);
strcpy(SymbolName + 1, ProcName);
SymbolName[0] = '_';
if (NSIsSymbolNameDefined(SymbolName))
Symbol = NSLookupAndBindSymbol(SymbolName);
free(SymbolName);
return Symbol ? NSAddressOfSymbol(Symbol) : NULL;
}
void* Sys_GLGetExtension(const char* ProcName)
{
return Sys_GLGetProc(ProcName);
}