[C++-sig] Py ++ generated code contains static ...
Alexander Eisenhuth
newsuser at stacom-software.de
Fri Feb 9 10:05:09 CET 2007
Roman Yakovenko schrieb:
...
> > I tried Py++ GUI. The generated Boost.Python C++ code couldn't be
> compiled. Reason:
> >
> > (VC compile error):
> > <file location generated code> :
> > error C2352: 'Math::Math_E::what' : illegal call of non-static member
> function
> > <file location header> : see declaration of 'what'
> >
> > Coresponding Codesnips:
> >
> > <generated code> :
> > virtual char const * what( ) const {
> > if( bp::override func_what = this->get_override( "what" ) )
> > return func_what( );
> > else
> > return Math::Math_E::what( ); // (wrong, not static)
> > }
>
> You didn't provide enough details, but I think I can make reasonable
> assumption.
>
> First of all "what" function belong to Math_E_wrapper class
>
> struct Math_E_wrapper : Math::Math_E, boost::python::wrapper<Math::Math_E>
>
> Am I right?
Yes you're right
> If so, than the line "return Math::Math_E::what( ); " should be
> interpreted by compiler
> as a call to base class member function. I think can fix the error by
> changing generated
> code to be "return this->Math::Math_E::what( );"
You ment this->Math_E::what( );
>
> Can you test it?
I've tested "this->Math_E::what( )" and it compiled !
Thanks a lot for that hint.
> P.S. If it is possible than switch to MSVC 7.1 compiler. It is much better.
I know, but I cannot switch at the moment.
At stdout there are a lot of warnings like:
WARNING: void Math::XYZ_TC<long unsigned int>::GetPolar(double & pol_, double &
pol_a, double & mer) const [member function]
> warning W1009: The function takes as argument (name=mer, pos=2)
> non-const reference to Python immutable type - function could not be
> called from Python. Take a look on "Function Transformation"
> functionality and define the transformation.
The warning say that the methode couldn't be called from python because:
- argument mer is a "in/out" argument
The solution according to Function Transformation":
1) Write wrapper code
2) Use py++ on the python side
Right?
Alexander
More information about the Cplusplus-sig
mailing list