[patch] Use dlsym instead of glXGetProcAddress in xdriinfo

Brian Paul brian.paul at tungstengraphics.com
Wed Nov 23 07:52:37 PST 2005


Ian Romanick wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Eric Anholt wrote:
> 
> 
>>@@ -57,8 +58,8 @@
>>     char *funcArg = NULL;
>>     char *dpyName = NULL;
>> 
>>-    GetScreenDriver = (glXGetScreenDriver_t *)glXGetProcAddress ("glXGetScreenDriver");
>>-    GetDriverConfig = (glXGetDriverConfig_t *)glXGetProcAddress ("glXGetDriverConfig");
>>+    GetScreenDriver = (glXGetScreenDriver_t *)glXGetProcAddressARB ("glXGetScreenDriver");
>>+    GetDriverConfig = (glXGetDriverConfig_t *)glXGetProcAddressARB ("glXGetDriverConfig");
>>     if (!GetScreenDriver || !GetDriverConfig) {
>> 	fprintf (stderr, "libGL is too old.\n");
>> 	return 1;
> 
> 
> Actually, this code is totally bogus.  In X.org's default libGL,
> glXGetProcAddress *NEVER* returns NULL.  Ever.  Replace
> "glXGetScreenDriver" above with "glXLikesToSegfault" and you'll see what
> I mean. :)

At one time, querying "gl*" functions always returned non-null, but 
querying "glX*" functions would return NULL for invalid functions. 
Has that changed?

In any case, it's kind of against the rules to create new glX 
functions like glXGetScreenDriver without defining an extension and 
putting the proper suffix on the function name.

-Brian



More information about the xorg mailing list