[C++-sig] boost.python class inheritance

Roman Yakovenko roman.yakovenko at gmail.com
Thu Apr 26 14:55:40 CEST 2007


On 4/26/07, Florian Delizy <florian.delizy at unfreeze.net> wrote:
> > Basically what you want is to expose your class and say that one of
> > its base
> > classes is defined in Python.
> well, not exactly, I want to expose a C++ class using python, given the
> fact that this C++ class is derived (in C++) from another C++ class
> itself exposed in python using SWIG...

Boost.Python requires base class to be exposed before derived. Because you
don't want to expose wxFrame ( I perfectly understand why ) the only choice
left is to derive from class defined in Python.

> so basically I want to export this existing C++ inheritance link into
> python, but I don't want to rewrite all wxPython using boost.python
> (quite an intensive job I think).

Py++ could make it to be a pleasure :-)

> How does boost.python create this inheritance link (internally) ? I was
> thinking of something like retrieving a class descriptor from
> python/swig/wxPython and feeding it to boost.python class_ template ...
> (ok I could read the whole boost.python code for that ... but I don't
> know yet what to loof for ...)

Me too.

P.S. May be you should consider to use SWIG to expose the class.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070426/bd06280f/attachment.htm>


More information about the Cplusplus-sig mailing list