[cffi-devel] Re: The results of your email commands

Bruno Daniel bruno.daniel at gmx.net
Mon Oct 29 10:45:59 UTC 2007


Dear Attilla,

thanks for your lightning-speed answer! Thanks also for pointing me to
cffi-grovel. I'm going to have a close look on it. Maybe we could let
Verrazano generate the cffi-grovel calls after calling gccxml and cffi-grovel
would do the rest (creating the C wrappers, calling the compiler and
everything).

I just found this:
http://cffi-net.accela.net/html/cffi-grovel/spec-file-syntax.html#spec-file-syntax
"(cstruct-and-class ...)

Defines a CFFI foreign struct, as with cstruct and defines a CLOS class to be
used with it. This is useful for mapping foreign structures to
application-layer code that shouldn't need to worry about memory allocation
issues."

So it won't be necessary to free the memory manually (and call the destructor)
because this is automatically done in some kind of finalizer by the garbage
collector? This would be very convenient. In cases where the ownership of a
C++ object is passed to some other C++ object (e.g. in a C++ GUI library, the
dialog widget usually owns the widgets put into it and is responsible for
deleting them) we will have to avoid creating such a Lisp wrapper
object; otherwise the C++ object will be deleted twice.

Best regards,
  Bruno Daniel



More information about the cffi-devel mailing list