# HG changeset patch # User Sam Lantinga # Date 995137886 0 # Node ID 7edee9f0f2ccd042f3e1841d1ec61f26c3dc4a6d # Parent 5a9c36a45db179736256fc356c06c4618024028b SDL GL dynamic loading fix for OpenBSD diff -r 5a9c36a45db1 -r 7edee9f0f2cc src/video/x11/SDL_x11gl.c --- a/src/video/x11/SDL_x11gl.c Sat Jul 14 19:10:06 2001 +0000 +++ b/src/video/x11/SDL_x11gl.c Sat Jul 14 19:11:26 2001 +0000 @@ -393,7 +393,9 @@ 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 @@ 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 */ diff -r 5a9c36a45db1 -r 7edee9f0f2cc src/video/x11/SDL_x11gl_c.h --- a/src/video/x11/SDL_x11gl_c.h Sat Jul 14 19:10:06 2001 +0000 +++ b/src/video/x11/SDL_x11gl_c.h Sat Jul 14 19:11:26 2001 +0000 @@ -28,6 +28,9 @@ #ifdef HAVE_OPENGL #include #include +#if defined(__OpenBSD__) && !defined(__ELF__) +#define dlsym(x,y) dlsym(x, "_" y) +#endif #endif #include "SDL_sysvideo.h"