"Hoehle, Joerg-Cyril" Joerg-Cyril.Hoehle@t-systems.com writes:
ffi:memory-as is a perfect match for %mem-ref
Sure, sure. We would have used it if it were documented. ;-)
You didn't read the documentation recently, did you?
Heh. :-)
Something like this?
(let ((cb-fun (get ',name 'clisp-callback-function)))
(when cb-fun (ffi:foreign-free cb-fun)))
(setf (get ',name 'clisp-callback-function) ,cb-var)
The comments specifically meant that this would not work, because (foreign-free #.#<FOREIGN-ADDRESS>) -> free(), which is not appropriate, while (foreign-free #.#<FOREIGN-FUNCTION>) lets clisp recognize and free the function.
Yes, exactly. And (type-of cb-var) => FFI:FOREIGN-FUNCTION.
CFFI> (defcallback foo :void ()) FOO CFFI> (get 'foo 'cffi-sys::clisp-callback-function) #<FOREIGN-FUNCTION #x004005E4> CFFI> (ffi:foreign-free *) NIL
If so, could these symbols CFFI uses be exported?
I'm looking into that.
Thanks!