- print '# define __getPublicProcAddress(name) dlsym(RTLD_NEXT, 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'