[cffi-devel] Re: unnamed callback (closures?)

Jan Rychter jan at rychter.com
Sun Feb 5 20:40:31 UTC 2006


>>>>> "Luís" == Luís Oliveira <luismbo at gmail.com> writes:
 Luís> Jan Rychter <jan at rychter.com> writes:
 >> Apart from a plea for suggestions, this brings me back to my
 >> original question -- can we expect any support for anonymous
 >> callbacks (closures as callback functions) in CFFI, at least on SBCL
 >> to begin with?

 Luís> I'm pretty sure we could support anonymous callbacks, on SBCL and
 Luís> CLISP anyway. Do any other Lisps support this?

Quick googling of Lispworks and AllegroCL documentation seems to
indicate that in both cases one defines externally callable functions
with a macro. No mention of closures as callbacks. That would seem to
indicate that at least in these cases it isn't supported, but one would
have to ask the vendors to be sure.

ECL has si::make-dynamic-callback and would be able to support this, in
fact it seems that even defcallback expands to

[...]
          `(si::make-dynamic-callback
            #'(ext::lambda-block ,name ,arg-names , at body)
            ',name ',ret-type ',arg-types ,call-type)))
[...]

So, perhaps it is worth implementing as an optional feature. Hopefully
other implementations will follow suit.

--J.



More information about the cffi-devel mailing list