dmoore <[EMAIL PROTECTED]> wrote: > I've obviously spent too much time with dynamic languages. The problem > with what I'm trying to do is obvious: In C++ you simply can't pass > pointers to call a particular instance of a C++ class method so there > is no way to initialize the PyMethodDef with class methods instances.
It is possible in theory. You can do what python does when it makes a bound method and build a custom function at run time with the instance and method built in. How you build that function is tricky - you've basically got to poke object code onto the heap which implements the method call to that particular instance. Looking at this page might give you some ideas http://gcc.gnu.org/onlinedocs/gccint/Trampolines.html This probably isn't a good approach in reality though as it is very architecture / compiler dependent! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list