Dear List,
I tried out CFFI on SBCL linux yesterday and would like to give some feedback. 1) On SBCL the rt package is named sb-rt. 2) The string callback test does not compile nor does the qsort callback test. 3) All the other tests run.
I also have the following observations. * SBCL and CMUCL have alien integer types that can specify a number of bits. I have had success in optimizing lisp ffi by restricting values to xx bits so they can be immediately translated to fixnums. It seems a shame to lose this possiblity in a cffi.
* I often need to allocate foreign objects and put them in a lisp struct. I would then want to run a finalizer if the struct gets garbage collected, to free the allocated memory. A nice interface to the finalizer functionality on different systems would be a great feature for cffi.
Greetz Immanuel
*************************************************************************** I can, I can't. Tubbs Tattsyrup
-- Immanuel Litzroth Software Development Engineer Enfocus Software Antwerpsesteenweg 41-45 9000 Gent Belgium Voice: +32 9 269 23 90 Fax : +32 9 269 16 91 Email: Immanuell@enfocus.be web : www.enfocus.be ***************************************************************************
Hello,
On 27/set/2005, at 12:21, Immanuel Litzroth wrote:
I tried out CFFI on SBCL linux yesterday and would like to give some feedback.
- On SBCL the rt package is named sb-rt.
Hmm, but is it identical to the asdf-installable rt? http://www.cliki.net/RT
- The string callback test does not compile nor does the qsort
callback test.
You don't mention what SBCL version you are using, but it's probably something prior to 0.9.4.11. That's an SBCL bug and if you grab it from CVS head or wait a few days for 0.9.5 you'll see it's fixed there.
Except I just added a new callback test and SBCL fails that, heh. I'll report it to sbcl's mailing list in a second.
I also have the following observations.
- SBCL and CMUCL have alien integer types that can specify a number of
bits. I have had success in optimizing lisp ffi by restricting values to xx bits so they can be immediately translated to fixnums. It seems a shame to lose this possiblity in a cffi.
Hmm, I would assume SBCL/CMUCL translate sb-alien:int and c-call:int to a fixnum already but I can't say that I checked. Is my assumption incorrect?
- I often need to allocate foreign objects and put them in a lisp
struct. I would then want to run a finalizer if the struct gets garbage collected, to free the allocated memory. A nice interface to the finalizer functionality on different systems would be a great feature for cffi.
Indeed it would, and I already skimmed through the various manuals to check out the interfaces for that and noted them down, it's in my TODO list. :-)
Thanks,
On 27 Sep 2005 13:21:33 +0200, Immanuel Litzroth immanuell@enfocus.be said:
Immanuel> * I often need to allocate foreign objects and put them in a lisp struct. I would Immanuel> then want to run a finalizer if the struct gets garbage collected, to free the allocated Immanuel> memory. A nice interface to the finalizer functionality on different systems would Immanuel> be a great feature for cffi.
How do you keep control over what foreign things point to the foreign objects?
I've found that losing the last reference from Lisp is not usually a guarantee that the last reference is lost from the foreign side. Conversely, if you work around this by deliberately keeping a reference from Lisp to prevent the foreign object from being finalized, then you probably know exactly when it should be freed anyway.