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