• in the example file
integrators.c
, it should readdouble integrate_gq(probe_func_t f) {
..
double integrate_rectangle(probe_func_t f) {
• the sym link for the built library should be (on 10.7):
ln -s build/lib.macosx-10.7-intel-2.7/integrators.so
And here is the output I got running his examples by cut and paste. First the build:
And the exploration in Python. We load the library:
We fail to get our C integrator function to accept the Python-defined "probe" function as argument:
[ About _ in Python: here and here ]
A simple cytypes.CFUNCTYPE definition does the trick:
And the original example
Where I'm going:
• ctypes library documentation
• learn more about distutils
Getting that build from these four lines is simply amazing:
setup.py
And for reference, in case the page ever goes away here are his code listings:
integrators.h
integrators.c