[C++-sig] Boost.Python : Byref parameters
Joel Gerard
llywelyn.geo at yahoo.com
Fri Sep 26 20:40:12 CEST 2003
Hi All,
I'm trying to call a C++ member function from Python
that takes three ints by reference, and modifies them.
static f32 Normalize (f32& fx, f32& fy, f32& fz);
Furthermore, its overloaded:
f32 Normalize (void);
static f32 Normalize (Vector& kV);
I've wrapped it like so:
f32 (Vector::*VectorNormalize1)(void) =
&Vector::Normalize;
f32 (*VectorNormalize2)(Vector&)= &Vector::Normalize;
f32 (*VectorNormalize3)(f32&,f32&,f32&) =
&Vector::Normalize;
.def("Normalize",VectorNormalize1)
.def("Normalize",VectorNormalize2)
.def("Normalize",VectorNormalize3)
Only Normalize defined by VectorNormalize3 is broken
saying: "TypeError: unbound method
Boost.Python.function object must be called with
Vector instance as first argument (got float instance
instead)"
I think I'm doing something wrong with the
call-policies (since I have none), but I don't know
which ones to use. What am I doing wrong?
Can somebody explain what Boost is trying to do here?
Thanks,
Joel
=====
--------------------------------------
Email: joelgerard at canada.com
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
More information about the Cplusplus-sig
mailing list