#include struct A { int data; virtual int f() { return 0; } ~A() { std::cout << "Destructed" << endl; } }; std::vector> test3; std::vector> test4; void TestWriteDisk(boost::shared_ptr readDIsk) { test3.push_back(readDIsk); test4.push_back(readDIsk); } void CLearWrite() { test3.clear(); } BOOST_PYTHON_MODULE(PyWrap) { class_ >("A") .def("f", &A::f) ; boost::python::def("TestWriteDisk", TestWriteDisk, ""); boost::python::def("ClearWrite", CLearWrite, ""); } // PYTHON FILE // import NVMeCMDWrapper as PyWrap // PyWrap.TestWriteDisk(PyWrap.A()) // PyWrap.ClearWrite()