[C++-sig] bp::arg() also requires types to be declared

Roman Yakovenko roman.yakovenko at gmail.com
Wed Jun 21 07:06:42 CEST 2006

On 6/21/06, Niall Douglas <s_sourceforge at nedprod.com> wrote:
> It appears it's not only enums that must be defined before use with
> boost::python::arg() - also all types. This causes a fault here:
>         typedef bp::class_< TnFXAppEventLoop_wrapper, bp::bases<
> FX::FXObject >, std::auto_ptr<TnFXAppEventLoop_wrapper>,
> boost::noncopyable > TnFXAppEventLoop_exposer_t;
>         TnFXAppEventLoop_exposer_t TnFXAppEventLoop_exposer =
> TnFXAppEventLoop_exposer_t( "TnFXAppEventLoop", bp::init<
> bp::optional< char const *, FX::TnFXApp * > >((
> bp::arg("threadname")="Event Loop thread",
> bp::arg("app")=FX::TnFXApp::instance( ) )) );
> Here TnFXApp has not been declared to BPL before TnFXAppEventLoop.
> Problem is that TnFXApp needs TnFXAppEventLoop defined before it (in
> C++).
> We have a problem therefore. I can only see one should set
> use_keywords to False on every calldef taking a typed default
> parameter. Unfortunately, this is most of them and thus renders using
> bp::arg() useless.
> Ideas? How hard would it be to patch BPL to let this work usefully?

Niall, I have an idea, but unfortunately I don't have time to check
it. Please take a
look on pyplusplus/module_creator/class_organizer.py file. This file contains
algorithm - classic topological sort. It is used to define the order of exported
classes. I am sure you can improve it, so we will not have this problem.

Good luck!

Roman Yakovenko
C++ Python language binding

More information about the Cplusplus-sig mailing list