Question about docs

Robert P. Goldman rpgoldman at sift.info
Mon Sep 16 04:08:52 UTC 2013


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



More information about the cffi-devel mailing list