- print ' static void *libgl_handle = RTLD_NEXT;'
- print '# define __getPublicProcAddress(name) dlsym(libgl_handle, name)'
- print '# define __getPrivateProcAddress(name) __glXGetProcAddressARB((const GLubyte *)(name))'
- print ' static inline __GLXextFuncPtr __glXGetProcAddressARB(const GLubyte * procName);'
+ print '# define __getPublicProcAddress(name) __libgl_sym(name)'
+ print ' void * __libgl_sym(const char *symbol);'
+ print '# ifdef __APPLE__'
+ print '# define __getPrivateProcAddress(name) __getPublicProcAddress(name)'
+ print '# else'
+ print '# define __getPrivateProcAddress(name) __glXGetProcAddressARB((const GLubyte *)(name))'
+ print ' static inline __GLXextFuncPtr __glXGetProcAddressARB(const GLubyte * procName);'
+ print '# endif'