Moved getGLExtensionFuncPtr implementation into the .cpp to make it easier to

change it implementation without forcing a complete recompile.
This commit is contained in:
Robert Osfield
2005-11-23 10:16:25 +00:00
parent 42e79f93d2
commit a91b8fa40a
2 changed files with 51 additions and 52 deletions

View File

@@ -201,3 +201,53 @@ bool osg::isGLUExtensionSupported(unsigned int contextID, const char *extension)
return result;
}
#if defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
#define NOMINMAX
#endif // NOMINMAX
#include <windows.h>
#elif defined(__APPLE__)
#include <mach-o/dyld.h>
#else
#include <dlfcn.h>
#endif
void* osg::getGLExtensionFuncPtr(const char *funcName)
{
#if defined(WIN32)
return (void*)wglGetProcAddress(funcName);
#elif defined(__APPLE__)
std::string temp( "_" );
temp += funcName; // Mac OS X prepends an underscore on function names
if ( NSIsSymbolNameDefined( temp.c_str() ) )
{
NSSymbol symbol = NSLookupAndBindSymbol( temp.c_str() );
return NSAddressOfSymbol( symbol );
} else
return NULL;
#elif defined (__sun)
static void *handle = dlopen((const char *)0L, RTLD_LAZY);
return dlsym(handle, funcName);
#elif defined (__sgi)
static void *handle = dlopen((const char *)0L, RTLD_LAZY);
return dlsym(handle, funcName);
#elif defined (__FreeBSD__)
return dlsym( RTLD_DEFAULT, funcName );
#else // all other unixes
return dlsym(0, funcName);
#endif
}