On Thu, Sep 8, 2011 at 12:48 PM, Luís Oliveira luismbo@gmail.com wrote:
On Thu, Sep 8, 2011 at 5:30 PM, Liam Healy lnp@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.
I see this is a simple change to the function call interface: naming the struct means call by value; if you want to call by reference, use :pointer. We can even make a warning if you call by reference with the struct name and don't have FSBV loaded (remember we are going to keep this a separate system so that users don't have to load libffi if they don't need call by value). So this is an incompatible change to the call interface, essentially revoking CFFI's prior generosity in allowing structure name instead of :pointer. I definitely don't like the idea of making different defcstructs, that will be too confusing and a kludge.
Liam