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

Luís Oliveira luismbo at gmail.com
Thu Sep 8 16:48:57 UTC 2011


On Thu, Sep 8, 2011 at 5:30 PM, Liam Healy <lnp at healy.washington.dc.us> wrote:
> Why not defcstruct (suitably enhanced, of course) for everything?  I
> don't want to preclude calling by reference those foreign structures I
> also need to call by value.  So something that's called exclusively by
> reference should work too.  If an application which only calls by
> reference doesn't want to use the translators, we can leave them
> undefined.

Right now (defcfun foo :void (x some-struct-type)) is identical to
(defcfun foo :void (x (:pointer some-struct-type))). If you want to
change the former to be call-by-value we need a backwards-incompatible
change to DEFCSTRUCT such that a bare SOME-STRUCT-TYPE means
call-by-value.

I think you're right that adding ENHANCED-FOREIGN-TYPE to the
superclasses wouldn't be an issue.

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




More information about the cffi-devel mailing list