SDL GL dynamic loading fix for OpenBSD
authorSam Lantinga <slouken@lokigames.com>
Sat, 14 Jul 2001 19:11:26 +0000
changeset 1107edee9f0f2cc
parent 109 5a9c36a45db1
child 111 53e3d8ba4321
SDL GL dynamic loading fix for OpenBSD
src/video/x11/SDL_x11gl.c
src/video/x11/SDL_x11gl_c.h
     1.1 --- a/src/video/x11/SDL_x11gl.c	Sat Jul 14 19:10:06 2001 +0000
     1.2 +++ b/src/video/x11/SDL_x11gl.c	Sat Jul 14 19:11:26 2001 +0000
     1.3 @@ -393,7 +393,9 @@
     1.4  
     1.5  void *X11_GL_GetProcAddress(_THIS, const char* proc)
     1.6  {
     1.7 +	static char procname[1024];
     1.8  	void* handle;
     1.9 +	void* retval;
    1.10  	
    1.11  	handle = this->gl_config.dll_handle;
    1.12  #if 0 /* This doesn't work correctly yet */
    1.13 @@ -407,7 +409,16 @@
    1.14          return this->gl_data->glXGetProcAddress(proc);
    1.15  	}
    1.16  #endif
    1.17 -	return dlsym(handle, proc);
    1.18 +#if defined(__OpenBSD__) && !defined(__ELF__)
    1.19 +#undef dlsym(x,y);
    1.20 +#endif
    1.21 +	retval = dlsym(handle, proc);
    1.22 +	if (!retval && strlen(proc) <= 1022) {
    1.23 +		procname[0] = "_";
    1.24 +		strcpy(procname + 1, proc);
    1.25 +		retval = dlsym(handle, procname);
    1.26 +	}
    1.27 +	return retval;
    1.28  }
    1.29  
    1.30  #endif /* HAVE_OPENGL */
     2.1 --- a/src/video/x11/SDL_x11gl_c.h	Sat Jul 14 19:10:06 2001 +0000
     2.2 +++ b/src/video/x11/SDL_x11gl_c.h	Sat Jul 14 19:11:26 2001 +0000
     2.3 @@ -28,6 +28,9 @@
     2.4  #ifdef HAVE_OPENGL
     2.5  #include <GL/glx.h>
     2.6  #include <dlfcn.h>
     2.7 +#if defined(__OpenBSD__) && !defined(__ELF__)
     2.8 +#define dlsym(x,y) dlsym(x, "_" y)
     2.9 +#endif
    2.10  #endif
    2.11  #include "SDL_sysvideo.h"
    2.12