Hi, I'm trying to expose a C++ class' internals to python via boost::python. I can do integer/boolean functions fine, but as soon as I do a string get/set it craps out.
boost::python::class_<Entity, std::auto_ptr<pyEntity> >("Entity") //publics .def("isActive", &Entity::isActive) //bool .def("activate", &Entity::activate) //bool .def("deactivate", &Entity::deactivate) //bool //... .add_property("name", &Entity::getName) //compile error (1) .def("getName", &Entity::getName, boost::python::return_internal_reference<>()); //runtime error(2) Compile error (1) shows this: C:/MinGW/include/boost/python/detail/ invoke.hpp: In function `PyObject* boost::python::detail::invoke(boost::python::detail::invoke_tag_< false, true>, const RC&, F&, TC&) [with RC = boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<const std::string&>, F = const std::string&(rsblsb::Entity::*)() const, TC = boost::python::arg_from_python<rsblsb::Entity&>]': C:/MinGW/include/boost/python/detail/caller.hpp:199: instantiated from `PyObject* boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const std::string&(rsblsb::Entity::*)() const, Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const std::string&, rsblsb::Entity&>]' C:/MinGW/include/boost/python/object/py_function.hpp:38: instantiated from `PyObject* boost::python::objects::caller_py_function_impl<Caller>::operator() (PyObject*, PyObject*) [with Caller = boost::python::detail::caller<const std::string&(rsblsb::Entity::*)() const, boost::python::default_call_policies, boost::mpl::vector2<const std::string&, rsblsb::Entity&> >]' C:\Game\svn\Platform\Framework\Python\PyModuleSetup.cc:58: instantiated from here C:/MinGW/include/boost/python/detail/invoke.hpp:88: error: no match for call to `(const boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<const std::string&>) (const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' Runtime error 2 just crashes whenever I try: import modulename I = modulename.Entity() I.getName() Anyone have any idea what I can try? thanks a lot! -Shawn. -- http://mail.python.org/mailman/listinfo/python-list