pybind11

Overview

pybind11 is a tool which can be used to create Python bindings to C++ code. The 11 in it’s name is taken from the C++11 standard, because it makes use of C++11 language features to provide it’s functionality (and hence C++11 is the oldest C++ standard it supports).

Unlike some other binding creating software packages that expect to define general type conversion rules and C++ classes to create bindings for in separate interface files (such as Swig), pybind11 expects you to describe your binding interface in the C++ files themselves.

Examples

See https://github.com/mbedded-ninja/BlogAssets/tree/master/Programming/pybind11/cmake_example for a working example showing how to build Python bindings to C++ code maintained with the CMake build system.

There are other great examples created by pybind themselves, including a plain C++ example and a CMake project example.

Posted: September 25th, 2018 at 9:32 am
Last Updated on: September 27th, 2018 at 11:06 am