Jon Smirl, I took the liberty of CC'ing the lists again as it is a very valid point you make here.
On Mon, Mar 10, 2003 at 03:17:56PM -0800, Jon Smirl wrote: > --- José Fonseca <[EMAIL PROTECTED]> > wrote: > > On Mon, Mar 10, 2003 at 10:36:21PM +0000, Keith > > Whitwell wrote: > > > No, because one of the things C++ does is pass > > around an extra parameter -- > > > namely the 'self' pointer. The 'real' prototype > > looks something like: > > > > > > void Context::BlendFunc( Context *self, GLenum > > sfactor, GLenum > > > dfactor ) > > > > I know this, that's why I thought there could be a > > remote chance to make > > it work, as the arguments mostly match, i.e., ctx = > > self. > > > > I wasn't really paying attention to this, but don't > you just want to do this, compiled with c++.... > > _cdecl handler(Context* self, sfactor, dfactor) > { > self->(sfactor, dfactor); > } > > _cdecl will export the function as an non-name mangled > C entry point. _cdecl is from windows, I don't know > what the g++ equivalent is. You can probably inline > this and make it completely go away when compiled. Yes, this works as you say _if_ the method isn't virtual, or at least the exact type of the class is known at compile time, i.e., it's not an abstract Context *, but actually a non-abstract RadeonContext *. Unfortunately most interesting cases, you desired that method to be virtual. This means that if you really want to eliminate the call you need to write a different "_cdecl handler" for each of the inherited classes and update the function table in run-time. Or at least use a template to write all of them for you. I've never though of this [and e.g. all mesa wrappers so far have that extra redirection call], until Keith said that this [of updating the funcion table in run-time] was something he desired to use more extensively. Nevertheless, this solution will require the extensive use of templates and it won't be pretty, so I'll leave it to when the framework stabilizes. José Fonseca __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel