[C++-sig] Wrapping functions that return a raw pointer

Renato Araujo renatox at gmail.com
Sun May 3 21:27:10 CEST 2009


take a look in this documentation about return police and
ResultConverterGenerator.


http://www.boost.org/doc/libs/1_39_0/libs/python/doc/v2/reference.html#models_of_call_policies

For this specific case you can use this one:
http://www.boost.org/doc/libs/1_39_0/libs/python/doc/v2/manage_new_object.html


BR

On Sat, May 2, 2009 at 10:34 PM,  <hessiess at hessiess.com> wrote:
> How can I wrap a function which returns a raw pointer? for example the
> following generates tonnes of errors on compile:
>
> struct test
> {
>    int *get()
>    {
>        return new int(1);
>    }
> };
>
> BOOST_PYTHON_MODULE(test)
> {
>    using namespace boost::python;
>
>    class_<test>("test")
>        .def("get", &test::get);
> }
>
> Thanks
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>



-- 
Renato Araujo Oliveira Filho


More information about the Cplusplus-sig mailing list