On 8/17/07, Bastian Müller <[EMAIL PROTECTED]> wrote: > > ODE uses the following callback: > typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2); > that I interfaced by > (define-foreign-type dNearCallback (function void (c-pointer > dGeomID dGeomID))) > > For the collision detection call > void dSpaceCollide (dSpaceID space, void *data, dNearCallback > *callback); > I used > (define ode-space-collide > (foreign-lambda void "dSpaceCollide" dSpaceID c-pointer > dNearCallback)) > > As an example callback I defined: > (define-external (foobar (c-pointer data) (dGeomID geom1) (dGeomID > geom2)) void > (printf "collision") (newline)) > > Finally, I tried to do the actual call. > First, I tried: > (ode-space-collide space (null-pointer) foobar) > and during the simulation I got an > Error: bad argument count - received -2 but expected 3: error in > error > graphics.scm: 76 ode-space-collide <--
This has nothing to do with arguments, instead it means that the runtime system is completely screwed up. I assume it is due to "ode-space-collide": You *MUST* (_MUST_, /MUST/) use "foreign-safe-lambda[*]", instead of "foreign-lambda[*]" for foreign procedures that invoke, or may invoke callbacks. cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
