Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

Example

This is a simple demonstration of using cython to call C code from python to process numpy arrays.

Usage

The example include both options, either static linkage or dynamic.

  1. Static linkage:
$ python setup-static.py build_ext --inplace
  1. Link against a shared C library:
$ gcc -shared -fpic -o libtest.so test/test.c
$ LDFLAGS="-Ltest" python setup.py build_ext --inplace
  1. Now the library can be called in a native way like shown in main.py

Explanation

The C function is implemented in test.c. It takes a int64 vector as input and processes an output vector of the same type.

TODO: More explanation.