)
(progn
#+(or cmu scl)
- `(alien:make-alien ,(convert-from-uffi-type (eval type) :allocation) ,size)
+ (if (integerp size)
+ `(alien:cast
+ (alien:make-alien ,(convert-from-uffi-type (eval type) :allocation) ,size)
+ (array ,(convert-from-uffi-type (eval type) :allocation) ,size))
+ `(alien:cast
+ (alien:make-alien ,(convert-from-uffi-type (eval type) :allocation) ,size)
+ (array ,(convert-from-uffi-type (eval type) :allocation) nil)))
#+sbcl
- `(sb-alien:make-alien ,(convert-from-uffi-type (eval type) :allocation) ,size)
+ (if (integerp size)
+ `(sb-alien:cast
+ (sb-alien:make-alien ,(convert-from-uffi-type (eval type) :allocation) ,size)
+ (array ,(convert-from-uffi-type (eval type) :allocation) ,size))
+ `(sb-alien:cast
+ (sb-alien:make-alien ,(convert-from-uffi-type (eval type) :allocation) ,size)
+ (array ,(convert-from-uffi-type (eval type) :allocation) nil)))
#+lispworks
`(fli:allocate-foreign-object :type ',(convert-from-uffi-type type :allocate) :nelems ,size)
#+allegro
(let ((,var (alien:addr ,obj)))
,@body)))
#+sbcl
- (let ((obj (gensym)))
- `(sb-alien:with-alien ((,obj ,(convert-from-uffi-type (eval type) :allocate)))
- (let ((,var (sb-alien:addr ,obj)))
- ,@body)))
+ (let ((obj (gensym))
+ (ctype (convert-from-uffi-type (eval type) :allocate)))
+ (if (and (consp ctype) (eq 'array (car ctype)))
+ `(sb-alien:with-alien ((,obj ,ctype))
+ (let* ((,var ,obj))
+ ,@body))
+ `(sb-alien:with-alien ((,obj ,ctype))
+ (let* ((,var (sb-alien:addr ,obj)))
+ ,@body))))
#+lispworks
`(fli:with-dynamic-foreign-objects ((,var ,(convert-from-uffi-type
(eval type) :allocate)))