On 6/4/07, Alexander Eisenhuth <new...@st...> wrote:
> How to wrap methode Get with Boost.Python?
>
>
> class MyClass {
> public:
> MyClass();
>
> void GetX(double pos_x);
> [...]
>
>
> Py++ generates following code:
>
> [...]
> .def( bp::init< >() )
> .def(
> "Get"
> , &::MyClass::Get
> , ( bp::arg("pos_x")) )
> [...]
It generates the right code, that works just fine
> It seems that it (or gccxml) cannot distinguish between in and out parameter.
I am not sure I understand you. What do you mean under in/out arguments.
> I'v tried it with:
>
> .def(
> "GetX"
> , &::MyClass::GetX
> , bp::arg("")
> , bp::return_value_policy<bp::return_arg<1>() >()
>
> But when I try it in python:
>
> Boost.Python.ArgumentError: Python argument types in
> MyClass.GetX(MyClass, int)
> did not match C++ signature:
> GetX(class MyClass::LedPosition_C {lvalue}, int {lvalue} )
I guess you are doing wrong something else. Py++ contains
call_policies_tester.py. You can see that I use return_arg policy and
it works just fine. If you want to return int you should pass 2 to
call policy as argument.
If you can create small and complete example I will be glad to help you.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|