Hi, I'm having problems exposing a C++ class to python using Boost::Python (v1.84). I have defined the following code:
class TestClass { public: TestClass() {} }; void test(TestClass& self, std::string const &testStr) { std::cout << "BEFORE" <<std::endl; std::cout << testStr <<std::endl; std::cout << "AFTER" <<std::endl; // ... use self ... } BOOST_PYTHON_MODULE(my_module) { using namespace boost::python; class_<TestClass, std::shared_ptr<TestClass>>("TestClass").def("test", &test); } I then run the following python script: from my_module import TestClass message = "Hello" class_obj = TestClass() class_obj.test(message) but I get the following output: BEFORE Segmentation fault What am I doing wrong? Many thanks in advance, Rob
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig