[racket] math/matrix <--> FFI/array

From: Danny Yoo (dyoo at hashcollision.org)
Date: Wed Feb 13 12:14:45 EST 2013

On Wed, Feb 13, 2013 at 9:41 AM, Pierpaolo Bernardi <olopierpa at gmail.com> wrote:
> Another FFI question:
>
> I want to interface a C function which has the following signature:
>
> void iauA2tf(int ndp, double angle, char *sign, int ihmsf[4])

Example written:

    https://github.com/dyoo/ffi-tutorial/tree/master/ffi/tutorial/examples/output-byte-parameter


I cooked up a stub definition of iauA2tf that just writes into sign and ihmsf.

    https://github.com/dyoo/ffi-tutorial/blob/master/ffi/tutorial/examples/output-byte-parameter/src/output-byte-parameter.c

I modified the ffi signature so it uses _byte, rather than _int.  It
also uses _array/vector to make it nicer on client Racket code:

    https://github.com/dyoo/ffi-tutorial/blob/master/ffi/tutorial/examples/output-byte-parameter/output-byte-parameter.rkt#L16


Other than that, this should work ok.  Can you confirm?

Posted on the users mailing list.