r10752: 2005-09-17 Kevin Rosenberg (kevin@rosenberg.net)
[uffi.git] / src / objects.lisp
index cc4a9fef6ca25a06beb7221b6644e496cfd81196..46b72752dcc79b52b0a0f1944ad61eaee63f7ef6 100644 (file)
@@ -242,6 +242,11 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated."
   '(error "WITH-CAST-POINTER not (yet) implemented for ~A"
           (lisp-implementation-type)))
 
+ (defmacro convert-external-name (name) 
+   "Add an underscore to NAME if necessary for the ABI."
+   #+macosx `(concatenate 'string "_" ,name)
+   #-macosx name)
+
 (defmacro def-foreign-var (names type module)
   #-lispworks (declare (ignore module))
   (let ((foreign-name (if (atom names) names (first names)))
@@ -255,7 +260,7 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated."
     #+allegro
     `(define-symbol-macro ,lisp-name
       (ff:fslot-value-typed (quote ,(convert-from-uffi-type type :deref))
-                            :c (ff:get-entry-point ,foreign-name)))
+                            :c (convert-external-name (ff:get-entry-point ,foreign-name))))
     #+lispworks
     `(progn
       (fli:define-foreign-variable (,lisp-name ,foreign-name)