There is an issue loading mangled mesa symbols.
In _glapi_get_proc_address, there is the code:
#ifdef MANGLE
if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l')
return NULL;
#else
if (funcName[0] != 'g' || funcName[1] != 'l')
return NULL;
#endif
thus, if the user is mangling mesa, any string they give which does not
have the mangled name will quickly return NULL. Sure, fine, but then
eventually `find_entry' will be called for some paths, which contains
the code:
for(i from 1 to N...) {
const char *testName = gl_string_table + static_functions[i].Name_offset;
if (strcmp(testName, n) == 0) {
return &static_functions[i];
}
}
Unfortunately the static_functions table only contains the demangled
names. Thus, the user *cannot* load functions from a mangled mesa
library: if they use the non-mangled name, then the #ifdef in
_glapi_get_proc_address will bail on them without even searching; if
they use the mangled name, find_entry will iterate through the entire
table and never find a match because the table only contains the
non-mangled name.
I have verified that removing the `#ifdef MANGLE' case and simply
using the else clause allows the user to load basic functions, e.g.
`glBegin'. Of course, this means that a user must load `glBegin'
instead of `mglBegin' regardless of whether or not they are using
mangled Mesa.
I'm not really sure if that's a good thing or a bad thing, but I'll let
you decide. Please inform me which of these solutions you'd like to
see:
1. Remove the #ifdef MANGLE case. To load `glBegin', for example,
users must call `mglXGetProcAddress("glBegin")'. [1]
2. use an #ifdef MANGLE case in find_entry to dynamically build a
string which is essentially ("m" concat gl_string_table +
static_functions[i].Name_offset). Do the comparison based on
the dynamic string and the argument.
3. Change the table such that it contains `glBegin' (etc.) in the
unmangled case, and `mglBegin' in the mangled case.
4. other that I haven't thought of (please explain)
Thanks,
-tom
[1] I imagine glXGetProcAddressARB("glBegin") would work too. My use
case necessitates the former though, so I haven't tried.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev