Quoting [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> a pointer for the C code to use, the important thing is to avoid
> having the lisp gc move the byte vector around, which is accomplished
> by the use of register-lisp-value.

Are you sure?  I believe r-l-v just returns an integer index into a
global table that can later be used to retrieve the object again.  That
keeps it from being garbage collected, but not from movement in memory.

What I am "using" (not well-tested) is this:

(defun make-shareable-byte-vector (size)
  (make-array size
              :element-type '(unsigned-byte 8)
              :allocation :static-reclaimable))

(defmacro with-pointer-to-vector-data ((ptr-var vector) &body body)
  `(let ((,ptr-var ,vector))
     ,@body))


(The old discussion of whether this kind of thing is worth supporting at
all notwithstanding.)


d.
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to