C Python extension to export an Function

Pavel S pavel at schon.cz
Thu Sep 1 12:41:41 EDT 2016


If you're familiar with C++, I recommend to have a look at Boost::Python. 
Sample program:
#include <boost/python.hpp>
#include <iostream>
void world()
{
 std::cout << "hello world" << std::endl;
}
BOOST_PYTHON_MODULE( hello )
{
 using namespace ::boost::python;
 def( "world", &world );
}
Usage:
python -c "import hello; hello.world()"


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /