[racket] FFI Pass/Return By Value

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jun 5 04:44:16 EDT 2012

At Tue, 5 Jun 2012 00:43:05 -0400, Vince Kuyatt wrote:
> For example, I have the simple definition in Racket:
> (define cpv
>   (get-ffi-obj "_cpv" chipmunk (_fun _cpFloat _cpFloat -> _cpVect)))

At Tue, 5 Jun 2012 10:33:31 +0200, Jens Axel Søgaard wrote:
> I think the names with underscore is defined my MAKE_REF here:
> http://code.google.com/p/chipmunk-physics/source/browse/trunk/include/chipmunk/chipmunk_ffi.h

If `_cpv' is really a pointer to cpv(), then `(_fun ...)' isn't the
right type. Use

 (define cpv
   (function-ptr (get-ffi-obj "_cpv" chipmunk _pointer)
                 (_fun _cpFloat _cpFloat -> _cpVect)))


Posted on the users mailing list.