Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Example.cc
1 #include <boost/python.hpp>
2
3 char const * greet() {
4 return "hello, world";
5 }
6
7 struct World {
8 void set(std::string msg) { this->msg = msg; }
9 std::string greet() { return msg; }
10 std::string msg;
11 };
12
13 BOOST_PYTHON_MODULE(example) {
14 using namespace boost::python;
15
16 def("greet", greet);
17
18 class_<World>("World")
19 .def("greet", &World::greet)
20 .def("set", &World::set)
21 ;
22 }
python
World
Definition: Example.cc:7