This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

implementation independent sb-sys:system-area-pointer

1 post · 2560 views

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
(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))))
     sap))