Question about docs

I have been working with CFFI from quicklisp and am a bit puzzled about translate-from-foreign with defcstruct. The documentation says: "A user wishing to define other translations should use the :class argument to [defcstruct], page 33, and then define methods for [translate-from-foreign], page 52 and [translate-into-foreign-memory], page 54 that specialize on this class, possibly calling call-next-method to translate from and to the plists rather than provide a direct interface to the foreign object." But I don't see any documentation of the class option to defcstruct. Is there an example of writing one of these translators for a class somewhere? I've been having quite a bit of trouble. I have created a class for defcstuct (just using the source to try to use it properly), (cffi:defcstruct (node :class node-class) ...) and then have tried to make a translate-from-foreign method dispatching on NUSMV-NODE::NODE-CLASS. I get the error that my new class NUSMV-NODE::NODE-CLASS is not found: unknown CFFI type: NUSMV-NODE::NODE-CLASS. when I try to invoke this. But (FIND-CLASS 'NUSMV-NODE::NODE-CLASS) finds it successfully. I suspect this has something to do with things going awry in find-type-parser, but am insufficiently familiar with the code or intention to make further process. Thanks for any help, R

On Mon, Sep 16, 2013 at 5:08 AM, Robert P. Goldman <rpgoldman@sift.info> wrote:
unknown CFFI type: NUSMV-NODE::NODE-CLASS.
The CFFI type name is still NODE, so you should use that rather than NODE-CLASS in bits of code that except a CFFI type. HTH, -- Luís Oliveira http://kerno.org/~luis/

See the Antik complex number example, which turns the foreign complex number (structure) into a CL complex and vice versa. http://repo.or.cz/w/antik.git/blob/e85d75dc44a1e43b325f4be6c7fc86880902af79:... Liam
participants (3)
-
Liam Healy
-
Luís Oliveira
-
Robert P. Goldman