Changeset 20907

Show
Ignore:
Timestamp:
11/08/07 21:03:07 (1 year ago)
Author:
patrick
Message:

Use dlopen(3) on Mac OS X 10.4 and newer for symbol lookup.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/vrjuggler/vrj/Draw/OpenGL/ExtensionLoader.cpp

    r20495 r20907  
    2828 
    2929#include <vpr/vpr.h> 
    30 #include <vpr/Util/Debug.h> 
    3130 
    3231#if defined(VPR_OS_Darwin) && defined(VRJ_USE_COCOA) 
     
    3635#endif 
    3736 
    38 #if !defined(WIN32) && !defined(VPR_OS_Darwin
    39 #include <GL/glx.h> 
     37#if defined(VRJ_USE_X11
     38#  include <GL/glx.h> 
    4039#endif 
    4140 
    42 #if defined(VPR_OS_Darwin) 
    43 #include <mach-o/dyld.h> 
    44 #elif !defined(WIN32) 
    45 #include <dlfcn.h> 
     41// On Mac OS X 10.3 and older, use the less portable symbol lookup mechanism. 
     42#if defined(VPR_OS_Darwin) && VPR_OS_RELEASE_MAJOR < 8 
     43#  include <mach-o/dyld.h> 
     44#elif ! defined(VPR_OS_Windows) 
     45#  include <dlfcn.h> 
    4646#endif 
    4747 
     48#include <vpr/Util/Debug.h> 
    4849#include <vrj/Draw/OpenGL/ExtensionLoader.h> 
    4950 
     
    6061   VoidExtFunc found_func(NULL); 
    6162 
    62 #if defined(VPR_OS_Darwin) 
     63   // On Mac OS X 10.3 and older, use the less portable symbol lookup 
     64   // mechanism. 
     65#if defined(VPR_OS_Darwin) && VPR_OS_RELEASE_MAJOR < 8 
    6366   if ( NSIsSymbolNameDefined(name) ) 
    6467   { 
     
    6972      } 
    7073   } 
    71 #elif defined(WIN32
     74#elif defined(VPR_OS_Windows
    7275 
    7376   found_func = (void(__cdecl*)(void)) wglGetProcAddress(name); 
    7477 
     78   // On UNIX variants including Mac OS X 10.4 and newer, use dlopen(3). 
    7579#elif defined(VPR_OS_IRIX) || defined(VPR_OS_HPUX) || \ 
    7680      defined(VPR_OS_Linux) || defined(VPR_OS_FreeBSD) || \ 
    77       defined(VPR_OS_Solaris) 
     81      defined(VPR_OS_Solaris) || defined(VPR_OS_Darwin) 
    7882 
    7983   // Workaround for multiple nVidia/Linux installation bugs, based on code in 
     
    9498   } 
    9599 
     100   // We only have glX*() functions when we are using X11. 
     101#if defined(VRJ_USE_X11) 
    96102   if (__GetProcAddress == NULL) 
    97103   { 
     
    127133      } 
    128134   } 
     135#endif 
    129136 
    130137   if ( __GetProcAddress != NULL )