SDL GL dynamic loading fix for OpenBSD

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40111
This commit is contained in:
Sam Lantinga 2001-07-14 19:11:26 +00:00
parent 75213d1709
commit 8b57da4c5c
2 changed files with 15 additions and 1 deletions

View File

@ -393,7 +393,9 @@ int X11_GL_LoadLibrary(_THIS, const char* path)
void *X11_GL_GetProcAddress(_THIS, const char* proc)
{
static char procname[1024];
void* handle;
void* retval;
handle = this->gl_config.dll_handle;
#if 0 /* This doesn't work correctly yet */
@ -407,7 +409,16 @@ fprintf(stderr, "glXGetProcAddress returned %p and dlsym returned %p for %s\n",
return this->gl_data->glXGetProcAddress(proc);
}
#endif
return dlsym(handle, proc);
#if defined(__OpenBSD__) && !defined(__ELF__)
#undef dlsym(x,y);
#endif
retval = dlsym(handle, proc);
if (!retval && strlen(proc) <= 1022) {
procname[0] = "_";
strcpy(procname + 1, proc);
retval = dlsym(handle, procname);
}
return retval;
}
#endif /* HAVE_OPENGL */

View File

@ -28,6 +28,9 @@ static char rcsid =
#ifdef HAVE_OPENGL
#include <GL/glx.h>
#include <dlfcn.h>
#if defined(__OpenBSD__) && !defined(__ELF__)
#define dlsym(x,y) dlsym(x, "_" y)
#endif
#endif
#include "SDL_sysvideo.h"