there's a problem with WITH-FOREIGN-SLOTS that shows up when a c-struct is defined in one package and used from another one. here's an example:
(in-package :cl-user)
(defpackage :internals (:use :cl :cffi))
(defpackage :mypackage (:use :cl :cffi))
(in-package :internals)
(defcstruct foo (x :int))
(in-package :mypackage)
(with-foreign-object (fooptr 'internals::foo) (with-foreign-slots ((x) fooptr internals::foo) x))
(with-foreign-slots ((x) fooptr internals::foo) x) gets expanded to
(LET ((#:PTR2455 FOOPTR)) (SYMBOL-MACROLET ((X (FOREIGN-SLOT-VALUE #:PTR2455 'INTERNALS::FOO 'X))) X))
instead of
(LET ((#:PTR2455 FOOPTR)) (SYMBOL-MACROLET ((X (FOREIGN-SLOT-VALUE #:PTR2455 'INTERNALS::FOO 'INTERNALS::X))) X)) ; ^^^^^^^^^^^
the attached patch fixes this