Skip to content

Instantly share code, notes, and snippets.

@arosh
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arosh/9a277188b55271f34633 to your computer and use it in GitHub Desktop.
Save arosh/9a277188b55271f34633 to your computer and use it in GitHub Desktop.
very simple boost::python
#include <boost/python.hpp>
int add(int a, int b) {
return a + b;
}
BOOST_PYTHON_MODULE(hello) {
boost::python::def("add", &add);
}
from distutils.core import setup, Extension
hello = Extension(
'hello',
sources=['hello.cpp'],
libraries=['boost_python'])
setup(ext_modules=[hello])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment