[cffi-devel] Casting

christopher melen chris_melen at yahoo.com
Sat Apr 19 22:30:46 UTC 2008


Hi,

I've generated a set of CFFI bindings for FFTW
(http://www.fftw.org). FFTW has its own versions of
malloc and free (fftw_malloc, fftw_free). So for
example, one would do (where fftw_complex is a
specific FFTW type) -

fftw_complex *in;

in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)
* N);

There is a rudimentary set of SBCL bindings for FFTW
which binds the above in the following way -

(defun fftw-malloc-complex (size)
  (sb-alien:cast
   (fftw::|fftw_malloc| (*
*sizeof-fftw-complex-in-bytes* size))
   (* fftw::|fftw_complex|)))

My question is: how do I cast using CFFI?

Thanks,
Chris


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html



More information about the cffi-devel mailing list