/*I am sorry the prev post is a mistake...*/
//the c++ code
using namespace boost::python;
struct World
{
void set(std::string msg) { this-msg = msg; }
std::string greet() { return msg; }
std::string msg;
};
BOOST_PYTHON_MODULE(hello)
{
class_World(World)
.def(greet, World::greet)
Couple notes:
- boost.python issues better discuss in comp.lang.python.c++ group;
- debug your extension from python first, then embed it
- don't call PyFinalize()
zghelp wrote:
but the exception occur when run to print t.greet()
How can I solve it?
Providing exception text will be helpful.
Mike