How do I send/receive data structures to/from C functions using the cd verb?

For example if I have this C library saved as /tmp/example.dylib, how do I
call it from J?

// C code:
struct stuff {double a[2]; int i;};
void fn(struct stuff *x) {x->a[x->i] += 100;}

NB. J code:
data =: (2.3 4.5);0    NB. the data I would like to send to fn (array of 2
doubles; int)
'/tmp/example.dylib fn (declaration)' cd (parameters)

Specifically, what do I use for the (declaration) and what do I use for
(parameters)?
I presume I should use something from
https://www.jsoftware.com/help/dictionary/dx003.htm but I'm unsure how to
then specify it in the (declaration).

Is there a relevant example somewhere?

Thanks,
Alex
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to