anchor.diff:  ;;; FOREIGN-ALLOC and FOREIGN-FREE in UNWIND-PROTECT for the common usage
   ;;; when the memory has dynamic extent.
   
  +(declaim (inline %foreign-alloc))
   (defun %foreign-alloc (size)
     "Allocate SIZE bytes on the heap and return a pointer."
  +  (declare (type (unsigned-byte 32) size))
     (alien-sap (make-alien (unsigned 8) size)))
   
  +(declaim (inline foreign-free))
   (defun foreign-free (ptr)
     "Free a PTR allocated by FOREIGN-ALLOC."
  +  (declare (type system-area-pointer ptr))
     (free-alien (sap-alien ptr (* (unsigned 8)))))
   
   (defmacro with-foreign-pointer ((var size &optional size-var) &body body)
  
positive.code: 
  ;;;# Finalizers
  
  (defun finalize (object function)
    "Pushes a new FUNCTION to the OBJECT's list of
  finalizers. FUNCTION should take no arguments. Returns OBJECT.
  
negative.code: ;;; should be defined to perform a copy-in/copy-out if the Lisp
  ;;; implementation can't do this.
  
  (declaim (inline make-shareable-byte-vector))
  (defun make-shareable-byte-vector (size)
    "Create a Lisp vector of SIZE bytes can passed to
  WITH-POINTER-TO-VECTOR-DATA."
    ; (declare (type sb-int:index size))
    (make-array size :element-type '(unsigned-byte 8)))
  
  (defmacro with-pointer-to-vector-data ((ptr-var vector) &body body)
    "Bind PTR-VAR to a foreign pointer to the data in VECTOR."
    (let ((vector-var (gensym "VECTOR")))
      `(let ((,vector-var ,vector))
         (declare (type (simple-unboxed-array (*)) ,vector-var))
         (sb-sys:with-pinned-objects (,vector-var)
           (let ((,ptr-var (sb-sys:vector-sap ,vector-var)))
             ,@body)))))
  