[C++-sig] Cross-extension-module dependencies

David Abrahams dave at boost-consulting.com
Sat Sep 14 13:19:26 CEST 2002

From: "sashan" <sashang at ihug.co.nz>

> Hi
> After about a week of part-time fiddling I found that the info in the
Cross-extension-module dependencies document helped solve my problem. So I
set it up so that the Quaternion class I'm working with knows about the
Vector class (i.e stuck the appropriate export_converters and
import_converters in the right place). Now I can make use of Quaternion
member functions that take a Vector as an argument.  Problem is I've got a
function like this:
>  void Quaternion::ToAngleAxis (float& rfAngle, Vector3& rkAxis) const;
> that the compiler (VC++ 6.0) refuses to deal with because of the float&.
It basically says
> error C2665: 'from_python' : none of the 74 overloads can convert
parameter 2 from type 'struct boost::python::type<float &>'
> The other functions like
> void FromAngleAxis (const Real& rfAngle, const Vector3& rkAxis);
> compile fine.
> I don't know what to do. I don't understand why it's complaining about
float&? float is a primitive type so it shouldn't complain. I downloaded
the latest boost source today (14th September 2002).
> Any help appreciated. Thanks in advance.

Python has no type which contains a mutable C++ float, so the library
refuses to let you bind a non-const reference to one. Actually, Python has
no type which contains a float at all. The python float type contains an
immutable C++ double.


BTW, if you're not too far along in your project, you should consider
switching to Boost.Python v2, since it is going to be released within a
month and v1 will then be retired. It also imports/exports all converters

           David Abrahams * Boost Consulting
dave at boost-consulting.com * http://www.boost-consulting.com

More information about the Cplusplus-sig mailing list