wants with-callback
Bug #1834126 reported by
Chen Ruofan
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
Hi, I'm writing some Common Lisp numerical integration routines. These routines call numerical integration routines in GSL. Therefore callback need to be given to GSL routines.
The ideal way to do it is to build a callback and then pass it to GSL routines. And this callback is dismissed after the evaluation, in other words, with-callback is needed.
Right now, I define a global callback which holds the function which is to be integrated. It works, but obviously it is not thread safe. This is the reason why I want with-callback.
It would be better if we can define anonymous callback and pass it like an ordinary function.
Best Regards
To post a comment you must log in.
若凡你好!
Some Lisps support anonymous callbacks (e.g., SBCL's sb-alien: alien-lambda) but not all. Nevertheless, it'd be nice for CFFI to support that when possible. Marking this bug as wishlist item.
You may be able to work around this by reusing the same callback each time and using the dynamic scope. Something along these lines:
(defvar *foo*)
(defcallback bar ... (do-something-with *foo*))
Then:
(let ((*foo* <something>)) foreign- funcation (callback bar)))
(your-
BTW, have you seen Liam Healy's GSLL <https:/ /common- lisp.net/ project/ gsll/>?