1 | // Distributed under the Boost Software License, Version 1.0. (See |
---|---|
2 | // accompanying file LICENSE_1_0.txt or copy at |
3 | // http://www.boost.org/LICENSE_1_0.txt) |
4 | #include <boost/python/module.hpp> |
5 | #include <boost/python/def.hpp> |
6 | #include <boost/python/object.hpp> |
7 | #include <boost/python/class.hpp> |
8 | |
9 | using namespace boost::python; |
10 | |
11 | struct X |
12 | { |
13 | int x; |
14 | X(int n) : x(n) { } |
15 | }; |
16 | |
17 | int x_function(X& x) |
18 | { return x.x; |
19 | } |
20 | |
21 | |
22 | BOOST_PYTHON_MODULE(class_ext) |
23 | { |
24 | class_<X>("X", init<int>()); |
25 | def(name: "x_function", fn: x_function); |
26 | } |
27 | |
28 | #include "module_tail.cpp" |
29 |