Changeset 20908

Show
Ignore:
Timestamp:
11/08/07 21:05:28 (10 months ago)
Author:
patrick
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/branches/2.2/modules/vrjuggler/vrj/Draw/OGL/GlExtensionLoader.cpp

    r19901 r20908  
    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/OGL/GlExtensionLoader.h> 
    4950 
     
    5657   VoidExtFunc found_func(NULL); 
    5758 
    58 #if defined(VPR_OS_Darwin) 
     59   // On Mac OS X 10.3 and older, use the less portable symbol lookup 
     60   // mechanism. 
     61#if defined(VPR_OS_Darwin) && VPR_OS_RELEASE_MAJOR < 8 
    5962   if (NSIsSymbolNameDefined(name)) 
    6063   { 
     
    6568      } 
    6669   } 
    67 #elif defined(WIN32
     70#elif defined(VPR_OS_Windows
    6871 
    6972   found_func = (void(__cdecl*)(void)) wglGetProcAddress(name); 
    7073 
     74   // On UNIX variants including Mac OS X 10.4 and newer, use dlopen(3). 
    7175#elif defined(VPR_OS_IRIX) || defined(VPR_OS_HPUX) || \ 
    72    defined(VPR_OS_Linux) || defined(VPR_OS_FreeBSD) || defined(VPR_OS_Solaris) 
     76      defined(VPR_OS_Linux) || defined(VPR_OS_FreeBSD) || \ 
     77      defined(VPR_OS_Solaris) || defined(VPR_OS_Darwin) 
    7378 
    7479   /* Workaround for multiple nVidia/Linux installation bugs, based on code in OpenSG */       
     
    8792   } 
    8893 
     94   // We only have glX*() functions when we are using X11. 
     95#if defined(VRJ_USE_X11) 
    8996   if (__GetProcAddress == NULL) 
    9097   { 
     
    111118      } 
    112119   } 
     120#endif 
    113121 
    114122   if (__GetProcAddress != NULL)