[cffi-devel] New proposal for shareable-byte-vectors for Allegro

John Fremlin jf at msi.co.jp
Mon Jan 19 05:53:42 UTC 2009


After light testing and comments from Duane at Franz, this is our
proposed shareable-byte-vector implementation for Allegro.

(defun make-shareable-byte-vector (size)
  "Create a Lisp vector of SIZE bytes which be can passed to WITH-POINTER-TO-VECTOR-DATA."
  (make-array size :element-type '(unsigned-byte 8) :allocation :static-reclaimable))

(defmacro with-pointer-to-vector-data ((ptr-var vector) &body body)
  "Bind PTR-VAR to a foreign pointer to the data in VECTOR."
  `(let ((,ptr-var (ff:fslot-address-typed :unsigned-char :lisp ,vector)))
     , at body))

It seems to work well.

[...]





More information about the cffi-devel mailing list