changeset 110:7edee9f0f2cc

SDL GL dynamic loading fix for OpenBSD
author Sam Lantinga <slouken@lokigames.com>
date Sat, 14 Jul 2001 19:11:26 +0000
parents 5a9c36a45db1
children 53e3d8ba4321
files src/video/x11/SDL_x11gl.c src/video/x11/SDL_x11gl_c.h
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 */
--- 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 <GL/glx.h>
 #include <dlfcn.h>
+#if defined(__OpenBSD__) && !defined(__ELF__)
+#define dlsym(x,y) dlsym(x, "_" y)
+#endif
 #endif
 #include "SDL_sysvideo.h"