Add support for glutGetProcAddress() on Mac OS X and other platforms

via dlsym() (STR #1582)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5673 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2007-02-08 15:44:28 +00:00
parent a72fa970a7
commit 4d6faca615
3 changed files with 21 additions and 0 deletions

View File

@ -287,6 +287,12 @@
# define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))
#endif /* !HAVE_STRTOLL */
/*
* Do we have the dlsym() function?
*/
#undef HAVE_DLSYM
/*
* End of "$Id$".
*/

View File

@ -433,6 +433,9 @@ fi
AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
dnl Check for dlopen/dlsym...
AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
dnl Check for audio libraries...
AUDIOLIBS=""

View File

@ -43,6 +43,9 @@
# define GLX_GLXEXT_LEGACY
# include <GL/glx.h>
# endif // HAVE_GLXGETPROCADDRESSARB
# ifdef HAVE_DLSYM
# include <dlfcn.h>
# endif // HAVE_DLSYM
# define MAXWINDOWS 32
static Fl_Glut_Window *windows[MAXWINDOWS+1];
@ -439,8 +442,17 @@ int glutDeviceGet(GLenum type) {
GLUTproc glutGetProcAddress(const char *procName) {
# ifdef WIN32
return (GLUTproc)wglGetProcAddress((LPCSTR)procName);
# elif defined(HAVE_DLSYM)
char symbol[1024];
snprintf(symbol, sizeof(symbol), "_%s", procName);
return (GLUTproc)dlsym(RTLD_DEFAULT, symbol);
# elif defined(HAVE_GLXGETPROCADDRESSARB)
return (GLUTproc)glXGetProcAddressARB((const GLubyte *)procName);
# else
return (GLUTproc)0;
# endif // WIN32