trying to debug why i wasn't able to run flightgear on my laptop, i
think i found a problem with SGLookupFunction. the problem is that we
call dlclose() before we return the pointer to the GL function, and,
if i understand things correctly, this invalidates the handle and the
address might not be valid anymore (on my laptop i kept getting core
dumps).

anyway the fix is very simple: instead of calling dlopen() on libGL
and then passing the libGL handle to dlsym() one can simply invoke
dlsym on RTLD_DEFAULT (which is a special pseudo-handler that will
find the first occurrence of the desired symbol using the default
library search order). now i can run flightgear on both my laptop
(with a radeon mobility card) and on my desktop (nvidia card) and i
think the clouds actually look much better.

this is the patch:

RCS file: /var/cvs/SimGear-0.3/SimGear/simgear/screen/extensions.hxx,v
retrieving revision 1.13
diff -u -r1.13 extensions.hxx
--- simgear/screen/extensions.hxx       21 May 2004 14:50:49 -0000      1.13
+++ simgear/screen/extensions.hxx       23 Jun 2004 01:08:01 -0000
@@ -69,12 +69,7 @@
     // GLX extension is *not* guaranteed to be supported. An alternative
     // dlsym-based approach will be used instead.
 
-    void *libHandle;
-    void (*fptr)();
-    libHandle = dlopen("libGL.so", RTLD_LAZY);
-    fptr = (void (*)()) dlsym(libHandle, func);
-    dlclose(libHandle);
-    return fptr;
+    return (void (*)()) dlsym(RTLD_DEFAULT, func);
 #endif
 }

--alex--

-- 
| I believe the moment is at hand when, by a paranoiac and active |
|  advance of the mind, it will be possible (simultaneously with  |
|  automatism and other passive states) to systematize confusion  |
|  and thus to help to discredit completely the world of reality. |

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to