On 6/4/07, Matthias Janes <mat...@gm...> wrote:
> hi,
>
> I have a simple auto generated 'basictest2.cpp' and a 'basictest2.hpp'. when I try to build the Py++ code I get some warnings about need of call policy: as this is my first try I got a bit stuck
>
> Any help would be most appreciated:
>
>
> ****CODE: basictest2.cpp
>
> #include "basictest2.hpp"
>
> namespace __basictest2__ {
>
> str *const_0;
>
> str *__name__;
>
> void __init() {
> const_0 = new str("Basic Test OK");
>
> __name__ = new str("basictest2");
>
> }
>
> str *basictest2() {
>
> return const_0;
> }
>
> } // module namespace
>
> __ END
>
>
> ****CODE: basictest2.hpp
>
> #ifndef __BASICTEST2_HPP
> #define __BASICTEST2_HPP
>
> #include "builtin.hpp"
>
> using namespace __shedskin__;
> namespace __basictest2__ {
>
> extern str *const_0;
>
> extern str *__name__;
>
>
> extern str * __name__;
> void __init();
> str *basictest2();
>
> } // module namespace
> #endif
>
> __ END
>
>
>
>
>
> WARNING: extern __shedskin__::str * __basictest2__::basictest2() [free function]
> > compilation error W1050: The function returns "__shedskin__::str *"
> > type. You have to specify a call policies.Be sure to take a look on
> > Py++ defined call policies: http://language-
> > binding.net/pyplusplus/documentation/functions/call_policies.html#py-
> > defined-call-policies
In this case the right call policy to use is:
http://boost.org/libs/python/doc/v2/reference_existing_object.html
> WARNING: __basictest2__::const_0 [variable]
> > compilation error W1035: Py++ can not expose static pointer member
> > variables. This could be changed in future.
Well, as the warning says Py++ cannot expose the variable to Python.
The simple work around is to generate\write function, which will
return pointer to that object and expose it.
> WARNING: __shedskin__::str [class]
> > execution error W1040: The declaration is unexposed, but there are
> > other declarations, which refer to it. This could cause "no to_python
> > converter found" run time error. Declarations: extern
> > __shedskin__::str * __basictest2__::basictest2() [free function]
> > __test__::x [variable]
>
You configured Py++ to not expose __shedskin__::str type. Py++ warns
you about that.
You should decide what you want:
* to expose it as is
* to create code that will automatically convert __shedskin__::str to
Python string.
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|