diff src/video/x11/SDL_x11gl.c @ 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 a8360daed17d
children 0bcae11eba14
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 */