Skip to content

Demonstrates how to call a C++ class from Python using pybind11.

License

Notifications You must be signed in to change notification settings

bast/pybind11-demo

Repository files navigation

Build Status License

pybind11 demo

Demonstrates how to call a C++ class from Python using pybind11.

Tested on Linux and Mac: https://travis-ci.org/bast/pybind11-demo/builds

How to build this demo

git clone --recursive https://github.com/bast/pybind11-demo.git
cd pybind11-demo
mkdir build
cd build
cmake ..
make

Example test run

>>> from example import add
>>> add(2, 3)
5
>>> from example import Pet
>>> my_dog = Pet('Pluto', 5)
>>> my_dog.get_name()
'Pluto'
>>> my_dog.get_hunger()
5
>>> my_dog.go_for_a_walk()
>>> my_dog.get_hunger()
6

About

Demonstrates how to call a C++ class from Python using pybind11.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published