|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-23 15:14:54
My guess is that the crash is due to a buggy exception-handling
implementation in your compiler (2.95.x has known problems in this area).
The current Boost.Python relies on exception-handling to implement the
overloading mechanism (try the first function; if it throws an
argument_error, try the second function, etc...) I think you'll have better
luck with GCC 3.0.2.
Some work we're planning to do in the near future will eliminate EH as the
basis for overload resolution, but I would be reluctant to stick with 2.95.3
in any case, since any exception could cause you trouble.
-Dave
----- Original Message -----
From: "Paul F. Kunz" <paul_kunz_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, November 23, 2001 3:02 PM
Subject: [boost] Re: boost.python
> 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?
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk