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

Jean-Claude Beaudoin jean.claude.beaudoin at gmail.com
Fri Sep 9 06:50:03 UTC 2011


Has anyone of you given a look at what Franz did on this very subject for
their Allegro 8.2
(
http://www.franz.com/support/documentation/8.2/doc/contents.htm#foreign-functions
)
(
http://www.franz.com/support/documentation/8.2/doc/foreign-functions.htm#structs-by-value-1
)
They added a keyword argument to their def-foreign-call form and also added
a global variable ff:*pass-structs-by-value* that controls the default value
of the keyword arg.

What do you think of that?

Cheers,

Jean-Claude Beaudoin

On Thu, Sep 8, 2011 at 1:05 PM, Luís Oliveira <luismbo at gmail.com> wrote:

> On Thu, Sep 8, 2011 at 5:56 PM, Liam Healy <lnp at healy.washington.dc.us>
> wrote:
> > 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.
>
> That's Attila's suggestion. Break it and move on.
>
>
> > 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).
>
> That's nicer, but fsbv might be loaded for some other reason and thus
> silently break existing code.
>
>
> > 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.
>
> Just to be clear, the older defcstruct would become deprecated,
> removed from the user manual, etc.
>
> --
> Luís Oliveira
> http://r42.eu/~luis/
>
> _______________________________________________
> cffi-devel mailing list
> cffi-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20110909/b5dd7bf1/attachment.html>


More information about the cffi-devel mailing list