X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fobjects.lisp;h=358763e41fc829c815845886a3e898dcf31bd733;hb=2edbb8ace64a4303296fb5582a762070db3cbabd;hp=9de66f9767a4c3495e6eeef54910a0180fdc2d8c;hpb=0dbc9821c1d1f665a914585dcef97199e8334bf3;p=uffi.git diff --git a/src/objects.lisp b/src/objects.lisp index 9de66f9..358763e 100644 --- a/src/objects.lisp +++ b/src/objects.lisp @@ -121,11 +121,11 @@ an array of TYPE with size SIZE. The TYPE parameter is evaluated." #+mcl `(ccl:pref ,ptr ,(convert-from-uffi-type type :deref)) ) -#+mcl +#+(and mcl (not openmcl)) (defmacro deref-pointer-set (ptr type value) `(setf (ccl:pref ,ptr ,(convert-from-uffi-type type :deref)) ,value)) -#+mcl +#+(and mcl (not openmcl)) (defsetf deref-pointer deref-pointer-set) (defmacro ensure-char-character (obj) @@ -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)))