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/

_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to