Skip to content

Latest commit

 

History

History
49 lines (29 loc) · 653 Bytes

README.md

File metadata and controls

49 lines (29 loc) · 653 Bytes

python_c_ext

Simple examples for extending Python with C/C++

Build

Compile the extension module:

$ cd 01_hello_world
$ python3 setup.py build_ext --inplace

This can be done by make, too:

$ make

Run a python script using the extension:

$ python3 ext01.py

01_hello_world

A minimum extension module.

02_pointer

Use C/C++ pointer from Python.

03_filename

Pass a filename string from Python to C/C++.

04_nparray

Return C/C++ data as an np.array.

08_nparray_stride

Return a part of C/C++ data as an np.array.

09_sigint

Stop Python during long computation with Ctrl-C.