cpp-binding-demo
This is an implementation of the Cython demo/tutorial
cython
From within the rect
directory in order to build run:
python setup.py build_ext --inplace
To test (from within Python
interpreter):
import rect
rect_obj = rect.PyRectangle(1,2,3,4)
rect_obj.get_area()
dir(rect_obj)
pybind11
Test cases
To run the test cases
- Install
cmake
andboost
- Checkout
pybind11
from github:git clone https://github.com/pybind/pybind11.git
- Use
bash
(Errors when using fish shell)
Compiling
To build python module rect
from rect.cpp
c++ -O3 -Wall -shared -std=c++11 -fPIC `python3 -m pybind11 --includes` rect.cpp -o rect`python3-config --extension-suffix`
Or using a setup.py