0.7.5 sounds long ago…
>The cffi manual[1] seems to indicate that not all platforms of sbcl
>support callbacks.
I would indeed suppose that the callback support has some differences
across platforms.
>Can someone kindly help me understand the situation with callbacks?
>Is it a significant performance penalty?
>And are there any examples to look at on the good practices to follow
>while writing a callback? Do I need to have defcallback only at the
In case of SBCL/Linux I am using callbacks from FUSE. This seems to run
fine for days on the end. This is a purely user-side perspective, of
course.
One thing I would recommend to remember about is that with callbacks you
have much more diverse set of «interesting» effects. For normal FFI you
mainly care about memory ownership/management; for callbacks the code
you interact with can also have interesting ideas about thread
management, global error/signal handling, etc.
With FUSE, for example, I can use FUSE message parsing code and let it
call back to my handlers, but I cannot let FUSE event loop manage the
message fetching, because then it has ideas about thread management and
then SBCL GC crashes because its expectations are broken…
Infact, I see that callback support in sbcl is better than ccl in some
sense (for instance, cffi:defcallback need not be top level).
Also, there is this bug 310198[2] says "Support for them already
exists, and is utilized by CFFI. but the interface should be polished
and exported from SB-ALIEN" but also refers to some 1% deadlock.
Is it a significant performance penalty?
The manual suggests us to refer to funcall0..funcall3 but I could not
really make out from the relevant file. (iiuc, it is
src/runtime/funcall.c )