implementation independent sb-sys:system-area-pointer

Discussion of Common Lisp
Post Reply
Posts: 153
Joined: Tue Sep 03, 2013 5:32 am

implementation independent sb-sys:system-area-pointer

Post by joeish80829 » Sun Apr 13, 2014 8:39 am

I have this trivial garbage finalizer I'm using to automatically callm y del-mat function
which basically calls delete on the new that is created in the function my %mat
function wraps(not shown). I was told by someone at cffi-devel that

" You use sb-sys:system-area-pointer as type, and this will tie you to
SBCL. There is no reason for that.
How would I change the sb-sys:system-area-pointer type in the below code to make it
compatible with all implementations. I could use a concrete example based on the
below code since I'm still kind of new to this part of CFFI.Thanks in advance for
any help on this

Code: Select all

(defstruct (cvmatrix (:constructor %make-cvmatrix))
   (sap (%mat) :type sb-sys:system-area-pointer :read-only t))
  (defun make-cvmatrix (&optional enable-finalizer)
   (let* ((matrix (%make-cvmatrix))
           (sap (cvmatrix-sap matrix)))
 (when enable-finalizer
     (tg:finalize matrix (lambda () (del-mat sap))))

Post Reply