Skip to content

Commit

Permalink
SDL GL dynamic loading fix for OpenBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lantinga committed Jul 14, 2001
1 parent 654349e commit 340c83b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/video/x11/SDL_x11gl.c
Expand Up @@ -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 */
Expand All @@ -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 */
3 changes: 3 additions & 0 deletions src/video/x11/SDL_x11gl_c.h
Expand Up @@ -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"

Expand Down

0 comments on commit 340c83b

Please sign in to comment.