Dynamic opengl && plugins

I didn’t check this for a while, thus my posting now:

the march 14 cvs sdl 1.1 snapshot should catch the case where the
application isn’t linked with GL’ Since this was the problem I was
mostly experiencing with the xmms plugin I experimented with, I gave it a
try. To my surprise, sdl still couldn’t find the glx symbols. I took a
look at the code and found this:

handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL); 
/* Catch the case where the application isn't linked with GL */
if ( (handle == NULL) && (path == NULL) ) { 
	path = getenv("SDL_VIDEO_GL_DRIVER");  if ( path == NULL ) {
		path = DEFAULT_OPENGL; 
	}
	handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL); 
}
if ( handle == NULL ) { 
	SDL_SetError("Could not load OpenGL library");  return -1;
}

This piece of code doesn’t do what it was meant to do: handle will never
be NULL. In this context, the call to dlopen will equal

handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); 

which will return a handle to the main program. This doesn’t check for glx
at all and can thus not catch the ‘plugin situation’. The if clause
should read:

if ( (dlsym(handle, "glXChooseVisual") == NULL) && (path == NULL) ) { 

or similar, in which case it will do what it is supposed to do.

cheers,--------------------------------------------------------------
Christian Zander ** N?ckersberg 76 ** 45257 Essen ** Germany email:
mbox at minion.de ** www: www.minion.de ** icq#: 5322926

This doesn’t check for glx
at all and can thus not catch the ‘plugin situation’. The if clause
should read:

if ( (dlsym(handle, “glXChooseVisual”) == NULL) && (path == NULL) ) {

or similar, in which case it will do what it is supposed to do.

Thanks! This is in the latest CVS snapshot.

See ya,
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec