On 10/15/06, Mark Hoemmen mark.hoemmen@gmail.com wrote:
typedef struct { double re; double im; } z_t; void zconverter (double* re, double* im, z_t thing) { double _Complex* thingptr = (double _Complex*) &thing; *re = creal ( *thingptr ); *im = cimag ( *thingptr ); }
[...]
Would this be a start?
IIUC, you return to the same problem. You can't pass that z_t thing to zconverter() through CFFI. What you have to do is, for each foreign function that wants a complex number as parameter, write a C wrapper that will take two doubles (in addition to whatever other arguments the functions wants) and call the appropriate function with a newly created complex number. Similar wrapping would be necessary for functions that return complex numbers.
HTH.