Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-04-07 17:47:05

----- Original Message -----
From: "David GD Wilson" <firestar_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, April 07, 2002 8:34 AM
Subject: [boost] export_converters() in vc7

> Hi,
> I am trying to export a C++ class (CVector) defined in a boost.python
> module to use in another boost.python module, however I get the
> error:
> c:\sdk\boost_1_27_0\boost\python\cross_module.hpp(215): error C2665:
> 'boost::python::from_python' : none of the 59 overloads can convert
> parameter 2 from type 'boost::python::type<T>'
> with
> [
> T=boost::shared_ptr<CVector> &
> ]
> Is this a bug in the boost python implementation?

Of course not; the library has no bugs <.03wink>**!
Seriously, it's really rather hard to say whether the bug is in your
code, in VC7 (not unheard of) or in the library, without seeing all of
it, and the error message that it induces.

> This compiles fine
> under linux, using gcc.

That tends to implicate the compiler, but I can't really be sure.

> The code exporting CVector is:
> // Create an object representing this extension module.
> module_builder core_module( "core" );
> // CVector definition
> class_builder< CVector > vector_class( core_module, "CVector" );
> // Add the __init__ function
> vector_class.def( constructor<>() );
> vector_class.def( constructor< float, float, float >() );
> // Add readable/writable member variable
> vector_class.def_read_write( &CVector::x, "x" );
> vector_class.def_read_write( &CVector::y, "y" );
> vector_class.def_read_write( &CVector::z, "z" );
> export_converters( vector_class );

In particular, it might be helpful to see the line in your code which
triggers the error.


** Strictly speaking, the Boost.Python v1 implementation only works
because of a bug: it exploits a bug which is present in many C++
implementations, including VC7
( for more
details). That's part of the reason that Boost.Python v2 is being
implemented, and is already available in the boost CVS.

Boost list run by bdawes at, gregod at, cpdaniel at, john at