Re: Idea/proposal/question DEF-FOREIGN-VAR

Edi Weitz <[email protected]> 23 Aug 2003 00:31:28 +0200
Newsgroups gmane.lisp.uffi.general
Message-ID <[email protected]>
There was a thinko in my LW definition of DEF-FOREIGN-VAR - due to my
use of GENSYM the macro might not work in certain situations. However,
it turns out the temporary symbol is actually not necessary, so here's
a patch:

edi@bird:/tmp > diff -u uffi-1.3.1/src/objects.lisp /usr/local/lisp/source/uffi/src/objects.lisp
--- uffi-1.3.1/src/objects.lisp Fri Aug 15 04:37:49 2003
+++ /usr/local/lisp/source/uffi/src/objects.lisp        Sat Aug 23 00:25:03 2003
@@ -243,14 +243,13 @@
       (ff:fslot-value-typed (quote ,(convert-from-uffi-type type :deref))
                             :c (ff:get-entry-point ,foreign-name)))
     #+lispworks
-    (let ((temp-name (gensym)))
-      `(progn
-        (fli:define-foreign-variable (,temp-name ,foreign-name)
-                                     :accessor :address-of
-                                     :type ,var-type
-                                     :module ,module)
-        (define-symbol-macro ,lisp-name (fli:dereference (,temp-name)
-                                                         :copy-foreign-object nil))))
+    `(progn
+      (fli:define-foreign-variable (,lisp-name ,foreign-name)
+                                    :accessor :address-of
+                                    :type ,var-type
+                                    :module ,module)
+      (define-symbol-macro ,lisp-name (fli:dereference (,lisp-name)
+                                                        :copy-foreign-object nil)))
     #-(or allegro cmu scl sbcl lispworks)
     `(define-symbol-macro ,lisp-name
       '(error "DEF-FOREIGN-VAR not (yet) defined for ~A"

Cheers,
Edi.