[cffi-devel] Foreign struct

Luís Oliveira luismbo at gmail.com
Wed Jun 11 07:42:40 UTC 2008


On Wed, Jun 11, 2008 at 2:44 AM, Liam Healy <lnp at healy.washington.dc.us> wrote:
> There is a GSL function that sets the real and imaginary parts of the
> struct (in C of course).  When I use this, I get the answer I expect.
> Unfortunately, it's more restricted than setting the structure in CL,
> so I'd like to solve the structure problem.

I'm surprised that works. It seems that GSL's complex operators are
passed gsl_complex structs by value. That is not supported by CFFI.
Unless GSL provides another way to handle complex values, you'll
probably need to write C wrappers for each complex operator that take
two doubles and pass them as a struct. (Or a single wrapper that calls
a function pointer, I suppose.)

OTOH, CL already has all of these operators so perhaps you're doing
something else. Can you show me an example?

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/



More information about the cffi-devel mailing list