anchor.diff:                       :test #'string=)))
       (jcall (jmethod "java.lang.reflect.Field" "setAccessible" "boolean")
              field +true+)
  -    (jcall (jmethod "java.lang.reflect.Field" "get" "java.lang.Object")
  -           field instance)))
  -
  -;;; XXX: doesn't match jmethod-arguments.
  -(defun private-jmethod (class-name method-name)
  -  (let ((method (find method-name
  -                      (jcall (jmethod "java.lang.Class" "getDeclaredMethods")
  -                             (jclass class-name))
  -                      :key #'jmethod-name
  -                      :test #'string=)))
  -    (jcall (jmethod "java.lang.reflect.Method" "setAccessible" "boolean")
  -           method +true+)
  -    method))
  -
  -(defun private-jconstructor (class-name &rest params)
  -  (let* ((param-classes (mapcar #'jclass params))
  -         (cons (find-if (lambda (x &aux (cons-params (jconstructor-params x)))
  -                          (and (length= param-classes cons-params)
  -                               (loop for param in param-classes
  -                                     and param-x across cons-params
  -                                     always (string= (jclass-name param)
  -                                                     (jclass-name param-x)))))
  -                        (jcall (jmethod "java.lang.Class"
  -                                        "getDeclaredConstructors")
  -                               (jclass class-name)))))
  -    (jcall (jmethod "java.lang.reflect.Constructor" "setAccessible" "boolean")
  -           cons +true+)
  -    cons))
  -
  -;;;# Symbol Case
  -
  -(defun canonicalize-symbol-name-case (name)
  -  (string-upcase name))
  -
  -;;;# Pointers
  -
  -(deftype foreign-pointer ()
  -  '(satisfies pointerp))
  -
  -(defun pointerp (ptr)
  -  "Return true if PTR is a foreign pointer."
  -  (let ((jclass (jclass-of ptr)))
  -    (when jclass
  -      (jclass-superclass-p (jclass "com.sun.jna.Pointer") jclass))))
  -
  -(defun make-pointer (address)
  -  "Return a pointer pointing to ADDRESS."
  -  (jnew (private-jconstructor "com.sun.jna.Pointer" "long") address))
  -
  -(defun %pointer-address (pointer)
  -  (private-jfield "com.sun.jna.Pointer" "peer" pointer))
  +    (let ((get-jmethod (jmethod "java.lang.reflect.Field" "get" "java.lang.Object")))
  +      (lambda (instance)
  +        (jcall get-jmethod field instance)))))
  +
  +(let ((accessor (make-private-jfield-accessor "com.sun.jna.Pointer" "peer")))
  +  (defun %pointer-address (pointer)
  +    (funcall accessor pointer)))
   
   (defun pointer-address (pointer)
     "Return the address pointed to by PTR."
  
positive.code:   (ignore-errors (private-jconstructor "com.sun.jna.Function"
                                         "com.sun.jna.Pointer" "int" "java.lang.String")))
  
  (defun make-function-pointer (pointer convention)
    (apply
     #'jnew
     (if *jna-4.0.0-or-later-p*
         (private-jconstructor "com.sun.jna.Function"
                               "com.sun.jna.Pointer" "int" "java.lang.String")
         (private-jconstructor "com.sun.jna.Function"
                               "com.sun.jna.Pointer" "int"))
     pointer
     (jfield "com.sun.jna.Function"
             (convert-calling-convention convention))
     (when *jna-4.0.0-or-later-p*
       (list *jna-string-encoding*))))
  
  (defun lisp-value-to-java (value foreign-type)
    (case foreign-type
  
negative.code: WITH-POINTER-TO-VECTOR-DATA."
    (make-array size :element-type '(unsigned-byte 8)))
  
  
  (let ((method (jmethod "com.sun.jna.Pointer"
                         (jna-setter :char) "long" (jna-setter-arg-type :char))))
    (defun copy-to-foreign-vector (vector foreign-pointer)
      (loop for i below (length vector)
         do
           (jcall-raw method
                      foreign-pointer i
                      (aref vector i)))))
  
  ;; hand-roll the jna-getter method instead of calling %mem-ref every time through
  (let ((method (jmethod "com.sun.jna.Pointer" (jna-getter :char) "long")))
    (defun copy-from-foreign-vector (vector foreign-pointer)
      (loop for i below (length vector)
         do (setf (aref vector i)
                  (lispify-value (jcall-raw method foreign-pointer i)
                                 :char)))))
  
  (defmacro with-pointer-to-vector-data ((ptr-var vector) &body body)
    "Bind PTR-VAR to a foreign pointer to the data in VECTOR."
  