[racket] FFI Pass/Return By Value
The function-ptr code was the exact fix I needed to get it working. I
wasn't even thinking about the fact that _cpv was a function pointer.
Thank you so much for the help.
On Tue, Jun 5, 2012 at 4:44 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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)))
>
> instead.
>