X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fobjects.lisp;h=57611321ff93a71458ce00d1db6a5ed621063a45;hb=38bdd9ccd063be4b3e0658a880a705ccb0cfdeb1;hp=9de66f9767a4c3495e6eeef54910a0180fdc2d8c;hpb=49de6f6d8f67af0f2949d96bb90f2f97fe37a743;p=uffi.git diff --git a/src/objects.lisp b/src/objects.lisp index 9de66f9..5761132 100644 --- a/src/objects.lisp +++ b/src/objects.lisp @@ -166,10 +166,15 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated." (progn ,@body) (free-foreign-object ,var))) #+(or cmu scl) - (let ((obj (gensym))) - `(alien:with-alien ((,obj ,(convert-from-uffi-type (eval type) :allocate))) - (let ((,var (alien:addr ,obj))) - ,@body))) + (let ((obj (gensym)) + (ctype (convert-from-uffi-type (eval type) :allocate))) + (if (and (consp ctype) (eq 'array (car ctype))) + `(alien:with-alien ((,obj ,ctype)) + (let* ((,var ,obj)) + ,@body)) + `(alien:with-alien ((,obj ,ctype)) + (let* ((,var (alien:addr ,obj))) + ,@body)))) #+sbcl (let ((obj (gensym)) (ctype (convert-from-uffi-type (eval type) :allocate)))