anchor.diff:                      `((,name :pointer)
                         (,(extra-arg-symbol name type) size-t)))
                      (otherwise (list (list name type)))))))
  +
  +(defmacro with-pointer-to ((var value type) &body body)
  +  (with-gensyms (x)
  +    `(let ((,x ,value))
  +       (cffi:with-foreign-object (,var ,type)
  +         (setf (cffi:mem-ref ,var ,type) ,x)
  +         ,@body))))
  +
  +(defun expand-dyn (var-alist var type body)
  +  (labels ((var-symbol (name type)
  +             (cdr (assoc (cons name type) var-alist :test #'equal))))
  +    (let ((data (var-symbol var :data))
  +          (offset (var-symbol var :offset))
  +          (stride (var-symbol var :stride))
  +          (rows (var-symbol var :rows))
  +          (cols (var-symbol var :cols))
  +          (inc (var-symbol var :inc))
  +          (length (var-symbol var :length)))
  +      (case type
  +        (:matrix
  +         `((let ((,rows (matrix-rows ,var))
  +                 (,cols (matrix-cols ,var))
  +                 (,stride (matrix-stride ,var))
  +                 (,offset (matrix-offset ,var))
  +                 (,data (matrix-data ,var)))
  +             (declare (type fixnum ,offset ,stride ,rows ,cols))
  +             ;; check overflow
  +             (unless (matrix-counts-in-bounds-p
  +                      (length ,data) ,offset ,stride ,rows ,cols)
  +               (matrix-storage-error "Argument ~A is out of bounds" ',var))
  +             ;; get pointer
  +             (cffi-sys:with-pointer-to-vector-data (,var ,data)
  +               ,@body))))
  +
  +        (:vector
  +         (expand-dyn var-alist var :matrix
  +                     `((let ((,inc (matrix-counts-vector-increment ,rows ,cols ,stride))
  +                             (,length (* ,rows ,cols)))
  +                         ,@body))))
  +        (otherwise body)))))
  +
   
   ;; TODO:
   ;;   - output and in/out parameters
  
positive.code:          ;; declare types
           ,@(when matrix-args `((declare (type matrix ,@matrix-args))))
           ;; bind counts
           ,@(expand-bind-counts
              args
              `( ;; check sizes
                ,@(loop
                     for (name type . params) in args
                     for length-checks = (loop for param in params
                                            when (and (consp param) (find (first param) '(:length :rows :cols)))
                                            collect (var-symbol (second param) (first param)))
                     when (cdr length-checks)
                     collect `(assert (= ,@length-checks)))
                  ;; make the damn call
                  (,c-name ,@(loop for (name type . params) in args
                                append (true-arg name type params)))))
           ;;output
  
  
  
           ,@(cond
              ((null inout-args) nil)
              ((= 1 (length inout-args)) inout-args)
  
negative.code:                                       (cons (cons name :stride) (prefix-gensym "STRIDE" name))))))))
      (labels ((var-symbol (name type)
                 (cdr (assoc (cons name type) var-alist :test #'equal)))
               (true-arg (name type params)
                 (cond
                   ((eq type :vector)
  