Boost logo

Boost :

From: Paul F. Kunz (paul_kunz_at_[hidden])
Date: 2001-11-23 15:02:39


   I'm having trouble with boost.python when a C++ class has more than
one constructor. When I try to create an object with the 2nd or
later constructor, Python crashes immediately with no error message.
That is, the first constructor defined in the list of .def()'s works,
and the rest fail.

My code looks like...

/// Create the Python type object for our extension class.
 python::class_builder<HiNTuple> HiNTuple_class(this_module, "NTuple");

/// Add the __init__ function.
HiNTuple_class.def ( boost::python::constructor<>());

/// Add the __init__ function with file name.
HiNTuple_class.def ( boost::python::constructor < const std::string & >() );

/// Add the __init__ function taking number of columns
HiNTuple_class.def ( boost::python::constructor< int > () );

My environment...
- RedHat 7.1
- Python 1.5.2 that came with the above
- gcc 2.95.3
- boost_1_25_0

   Any ideas?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk