Skip to content

Instantly share code, notes, and snippets.

@shimarin
Created March 18, 2011 17:27
Show Gist options
  • Select an option

  • Save shimarin/876484 to your computer and use it in GitHub Desktop.

Select an option

Save shimarin/876484 to your computer and use it in GitHub Desktop.
Python module using Boost
/*
* g++ `python-config --includes` `python-config --libs` -lboost_python -fPIC -shared -o hello.so hello.cpp
*/
#include <boost/python.hpp>
using namespace boost::python;
char const* greet(){
return "hello, world";
}
BOOST_PYTHON_MODULE(hello){
def("greet", greet);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment