On Thu, Dec 07, 2006 at 12:17:24AM +0100, Stelian Ionescu wrote:
>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:
>the attached patch fixes this
this time I've attached it

-- 
(sign :name "Stelian Ionescu" :aka "fe[nl]ix"
      :quote "Quidquid latine dictum sit, altum sonatur.")
--- old-cffi/src/types.lisp     2006-12-05 01:12:07.000000000 +0100
+++ new-cffi/src/types.lisp     2006-12-05 01:12:07.000000000 +0100
@@ -452,11 +452,14 @@
 (defmacro with-foreign-slots ((vars ptr type) &body body)
   "Create local symbol macros for each var in VARS to reference
 foreign slots in PTR of TYPE.  Similar to WITH-SLOTS."
-  (let ((ptr-var (gensym "PTR")))
+  (let ((ptr-var (gensym "PTR"))
+        (type-package (symbol-package type)))
     `(let ((,ptr-var ,ptr))
        (symbol-macrolet
            ,(loop for var in vars
-                  collect `(,var (foreign-slot-value ,ptr-var ',type ',var)))
+               for true-slot = (intern (string-upcase (symbol-name var))
+                                       type-package)
+               collect `(,var (foreign-slot-value ,ptr-var ',type 
',true-slot)))
          ,@body))))
 
 ;;;# Foreign Unions

Attachment: pgpCl51karDxR.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