Hello Nik,
On Mar 2, 2011 6:01 PM, "nitralime" <nitralime@googlemail.com> wrote:
Hopefully here is the right place to ask CFFI user related questions.
What would be an appropriate CFFI definition for the following C entities?
1) typedef enum {
a = 0x01,
b = 0x02,
c = a | b,
d = 0x04 | c
} test;
It's a bit cumbersome to express that with CFFI. Something like
(defcenum (:a 1) ... (:c #.(logior 1 2)) ...).
2) typedef char XXX[8];
How are the C arrays handled in CFFI?
There are some array operations such as mem-aref, and you can allocate
them using foreign-alloc. defcstruct supports arrays via :count.
There's also an :array type that will convert C arrays to Lisp arrays,
but it has some limitations and it's
undocumented (see src/types.lisp).
HTH,
--
Luís Oliveira
http://r42.eu/~luis