;;;;
;;;; $Id$
;;;;
-;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
+;;;; This file, part of UFFI, is Copyright (c) 2002-2005 by Kevin M. Rosenberg
;;;;
-;;;; UFFI users are granted the rights to distribute and use this software
-;;;; as governed by the terms of the Lisp Lesser GNU Public License
-;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
;;;; *************************************************************************
(in-package #:uffi)
#+(or (and mcl (not openmcl))) obj
#+(or allegro cmu sbcl scl openmcl) `(code-char ,obj)
;; lispworks varies whether deref'ing array vs. slot access of a char
- #+lispworks
- `(if (characterp ,obj) ,obj (code-char ,obj)))
+ #+lispworks `(if (characterp ,obj) ,obj (code-char ,obj)))
(defmacro ensure-char-integer (obj)
#+(or (and mcl (not openmcl))) `(char-code ,obj)
- #+(or allegro cmu sbcl scl openmcl) obj)
+ #+(or allegro cmu sbcl scl openmcl) obj
+ ;; lispworks varies whether deref'ing array vs. slot access of a char
+ #+lispworks
+ `(if (integerp ,obj) ,obj (char-code ,obj)))
(defmacro ensure-char-storable (obj)
#+(or lispworks (and mcl (not openmcl))) obj
'(error "WITH-CAST-POINTER not (yet) implemented for ~A"
(lisp-implementation-type)))
+ (defun 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)))
#+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 (ff:get-entry-point ,(convert-external-name foreign-name))))
#+lispworks
`(progn
(fli:define-foreign-variable (,lisp-name ,foreign-name)