chipmunk-rb / chipmunk-ffi

chipmunk ruby bindings using ffi
26 stars 6 forks source link

Can't use a callback in cp_static_inline signature #19

Open utgarda opened 13 years ago

utgarda commented 13 years ago

cp_static_inline doesn't take as function argument types any callbacks defined earlier in code. Never before was an issue, cause it's the first time static inline functions in chipmunk API have something except pointers and structs for args.

Thus, lines like this

   cp_static_inline :cpSpatialIndexEach, [:pointer, :cpSpatialIndexIteratorFunc, :pointer], :void

result in errors :

/chipmunk-ffi/lib/chipmunk-ffi.rb:35:in `initialize': Invalid parameter type (:cpSpatialIndexIteratorFunc) (TypeError)

Using a :pointer instead of a defined callback doesn't work either, passing a method where a :pointer argument is expected gives this:

:pointer argument is not a valid pointer
utgarda commented 13 years ago

Most of static inline functions in chipmunk headers are just simple convenience one-liners, so they can be implemented on our side without any productivity loss. Maybe that can work even faster. Just did that for cpSpatialIndexQuery, works ok so far.