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

-- 
(sign :name "Stelian Ionescu" :aka "fe[nl]ix"
      :quote "Quidquid latine dictum sit, altum sonatur.")

Attachment: pgpqQSuiL163A.pgp
Description: PGP signature

_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to