[C++-sig] Py ++ generated code contains static ...

Roman Yakovenko roman.yakovenko at gmail.com
Thu Feb 8 20:04:25 CET 2007


On 2/8/07, Alexander Eisenhuth <newsuser at stacom-software.de> wrote:
> Hello,
>
> Py++: 0.8.5
> Compiler: VC6.0
> GCC-XML version 0.6.0
>
> 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?

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(  );"

Can you test it?

Take a look on tutorials(
http://www.boost.org/libs/python/doc/tutorial/doc/html/python/exposing.html#python.virtual_functions_with_default_implementations)
The generated code is not that different.

> <header> :
>          virtual const char * what () const;

> At stdout there are a lot of warnings ... but they seems not be related on
what.
>   What is the reason?

I don't understand the question, can you explain what do you mean?

P.S. If it is possible than switch to MSVC 7.1 compiler. It is much better.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070208/3a838bf1/attachment.htm>


More information about the Cplusplus-sig mailing list