[cffi-devel] C99 complex datatypes?
Luís Oliveira
luismbo at gmail.com
Sun Oct 15 16:31:44 UTC 2006
On 10/15/06, Mark Hoemmen <mark.hoemmen at 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.
--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
More information about the cffi-devel
mailing list