[C++-sig] return_arg

Ira sheig222 at gmail.com
Wed Aug 3 08:44:30 CEST 2005


Hi,

Say I have a C++ class exposed to python. The C++ code creates an instance
of said class and I want to retrieve it from python code.

What would be the correct way for python code to 'get' the reference?
Regardless can someone please elaborate on the the whole "param passing &
return value" subject. It might be me but I had a hard time with
return_arg<> (I don't get what arg_pos is suppose to mean), and the example
discusses only return_self

What I *tried* to do is:

MyClass* pMyClass;

main()
{
    pMyClass = new MyClass;
}

MyClass* GetMyClass()
{
    return pMyClass;
}

BOOST_PYTHON_MODULE(mymod)
{
    class_<MyClass>.....

    def ("GetMyClass", GetMyClass);
}

This didn't compile with "C2027 use of unspecified type
boost::python::detail::specify_a_return_value_to_wrap_functions_returning<T>
with T=result_t".

I tried messing around with the def, adding return_arg<> but nothing did the
trick for me.

Cheers,
Ira






More information about the Cplusplus-sig mailing list