[cffi-devel] Converting foreign structures with CFFI generic functions

Luís Oliveira luismbo at gmail.com
Sun Aug 28 08:41:18 UTC 2011


On Sun, Aug 28, 2011 at 5:42 AM, Liam Healy <lnp at healy.washington.dc.us> wrote:
> Yes, thanks.  The subclassing of type names was confusing me.  The example
> makes it clear.  I think I will define a macro to make the creation of the
> translate-*-foreign and free-translated-object methods a little bit easier.

Earlier versions of CFFI's type system dealt with names instead of
classes for dispatching on types. Dealing with classes allows us to do
subclassing and, more importantly, store info in the type instances.
E.g. the string type will come with an encoding attached.

What kind of macro are you thinking of? In the COMPLEX case, do you
want to abstract away the need to allocate (and free) the structure
object explicitly?

-- 
Luís Oliveira
http://r42.eu/~luis/




More information about the cffi-devel mailing list