[cffi-devel] Re: `lambda-callback'
Lars Rune Nøstdal
larsnostdal at gmail.com
Thu Apr 27 08:14:21 UTC 2006
James Bielman <jamesjb <at> jamesjb.com> writes:
>
> Lars Rune Nøstdal <larsnostdal <at> gmail.com> writes:
>
> > I've been using this lately:
> >
> > (defvar *lambda-callbacks* nil
> > "TODO: Clean up later somehow?")
> >
> > (defmacro lambda-callback (return-type args &body body)
> > (let ((name (read-from-string (symbol-name (gensym)))))
> > `(progn
> > (defcallback ,name ,return-type ,args
> > , <at> body)
> > (push ',name *lambda-callbacks*)
> > (callback ,name))))
> >
> > ..maybe something like this could be included in cffi? :)
>
> Using CFFI's DEFCALLBACK in any non-toplevel context is probably a
> recipe for disaster on at least some of the Lisps we support, so I
> don't think this can work as a portable solution. (I don't understand
> the purpose of *LAMBDA-CALLBACKS* or the READ-FROM-STRING business
> either...)
Hm, you're right, the read-from-string stuff doesn't seem to be needed
(can't remember what I was thinking). Anyway, I guess this will have
to wait until someone finds a workaround that works for all, or all
(or maybe most of?) the Lisps support non-toplevel callbacks. :)
--
Lars Rune Nøstdal
http://lars.nostdal.org/
More information about the cffi-devel
mailing list