[cffi-devel] Documentation Feature Request

dherring at tentpost.com dherring at tentpost.com
Tue Feb 27 19:07:33 UTC 2007


> I've been trying to interface sbcl to the gsl library especially passing
> vectors and/or matrices.
>
> The docs state that there is no :array type.
>
> Is it somehow possible to interface to the gsl library to do e.g. spline
> or matrix ops ?
> If it is possible it would be nice to have one or two examples in the
> docs.

Here are a few projects that perform similar tasks; they might be what you
want.
http://www.nlisp.info/
http://matlisp.sourceforge.net/
http://common-lisp.net/project/cl-gsl/

That said, I think the CFFI side goes something like this.

; C and C++ pass pointers to arrays...
; For C's "int x[4][5]", use
(setq x (foreign-alloc :int :count 20))

Then its up to you to remember the dimensions...

(defun x-aref (x r c)
  (mem-aref x :int (+ (* r 5) c)))

- Daniel




More information about the cffi-devel mailing list