mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 17:32:55 +00:00
Merge Trunk changes to RC_1_29_0
[SVN r15732]
This commit is contained in:
@@ -9,22 +9,15 @@ namespace { // Avoid cluttering the global namespace.
|
||||
int square(int number) { return number * number; }
|
||||
}
|
||||
|
||||
#include <boost/python/class_builder.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
namespace python = boost::python;
|
||||
|
||||
// Python requires an exported function called init<module-name> in every
|
||||
// extension module. This is where we build the module contents.
|
||||
BOOST_PYTHON_MODULE_INIT(getting_started1)
|
||||
BOOST_PYTHON_MODULE(getting_started1)
|
||||
{
|
||||
try {
|
||||
// Create an object representing this extension module.
|
||||
python::module_builder this_module("getting_started1");
|
||||
|
||||
// Add regular functions to the module.
|
||||
this_module.def(greet, "greet");
|
||||
this_module.def(square, "square");
|
||||
}
|
||||
catch(...) {
|
||||
boost::python::handle_exception();
|
||||
}
|
||||
python::def("greet", greet);
|
||||
python::def("square", square);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user