aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/python/hello.cpp
blob: b7516e451fb865e7e719c2a674ed30f5eb1a85aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <string>

#include <boost/python.hpp>
using namespace boost::python;

struct World
{
    void set(const std::string& msg) { this->msg = msg; }
    std::string greet() const { return msg; }
    std::string msg;
};

BOOST_PYTHON_MODULE(hello)
{
    class_<World>("World")
        .def("greet", &World::greet)
        .def("set", &World::set)
    ;
}