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

Niall Douglas s_sourceforge at nedprod.com
Wed Jun 21 04:17:37 CEST 2006


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?

Cheers,
Niall






More information about the Cplusplus-sig mailing list