This is a simple demonstration of using cython to call C code from python to process numpy arrays.
The example include both options, either static linkage or dynamic.
- Static linkage:
$ python setup-static.py build_ext --inplace- Link against a shared C library:
$ gcc -shared -fpic -o libtest.so test/test.c
$ LDFLAGS="-Ltest" python setup.py build_ext --inplace- Now the library can be called in a native way like shown in main.py
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.