I'm just going to go ahead and patch the source, unless there is an easy way to do this already.
EDIT: oops, i just found chipmunk_ffi.h. I'll probably figure it out eventually, but just in case, how do I use it? I'm guessing recompile chipmunk with `-D CHIPMUNK_FFI`, and then `#define CHIPMUNK_FFI` to get the declarations? The functions will be prefixed with an underscore, right?
EDIT2: ok I put `-DCHIPMUNK_FFI` in the cflags, but that caused error messages:
Code: Select all
[ 12%] Building C object src/CMakeFiles/chipmunk.dir/chipmunk.c.o
In file included from /home/eee/builds/Chipmunk-6.0.1/src/chipmunk.c:170:0:
/home/eee/builds/Chipmunk-6.0.1/include/chipmunk/chipmunk_ffi.h:80:1: error: ‘cpShapeGetIsSensor’ undeclared here (not in a function)
/home/eee/builds/Chipmunk-6.0.1/include/chipmunk/chipmunk_ffi.h:80:1: error: ‘cpShapeSetIsSensor’ undeclared here (not in a function)
make[2]: *** [src/CMakeFiles/chipmunk.dir/chipmunk.c.o] Error 1
make[1]: *** [src/CMakeFiles/chipmunk.dir/all] Error 2
make: *** [all] Error 2
Now how do I get the include (#include "chipmunk/chipmunk.h") to have the correct declarations?
EDIT4: Neato! it worked:
Code: Select all
ffi.cdef[[
double (*_cpfclamp)(double f, double min, double max);
]]
cp=ffi.load 'chipmunk'
print(cp._cpfclamp(5, -1, 2))