Index: /trunk/ccl/lib/ffi-darwinppc32.lisp
===================================================================
--- /trunk/ccl/lib/ffi-darwinppc32.lisp	(revision 5758)
+++ /trunk/ccl/lib/ffi-darwinppc32.lisp	(revision 5759)
@@ -57,5 +57,5 @@
 ;;; integer argument "type" specifier to denote this.
 
-(defun darwin32::expand-ff-call (callform args)
+(defun darwin32::expand-ff-call (callform args &key (arg-coerce #'null-coerce-foreign-arg) (result-coerce #'null-coerce-foreign-result))
   (let* ((result-type-spec (or (car (last args)) :void))
          (enclosing-form nil))
@@ -106,7 +106,7 @@
                   (progn
                     (argforms (foreign-type-to-representation-type ftype))
-                    (argforms arg-value-form)))))))
+                    (argforms (funcall arg-coerce arg-type-spec arg-value-form))))))))
         (argforms (foreign-type-to-representation-type result-type))
-        (let* ((call `(,@callform ,@(argforms))))
+        (let* ((call (funcall result-coerce result-type-spec `(,@callform ,@(argforms)))))
           (if enclosing-form
             `(,@enclosing-form ,call)
Index: /trunk/ccl/lib/ffi-darwinppc64.lisp
===================================================================
--- /trunk/ccl/lib/ffi-darwinppc64.lisp	(revision 5758)
+++ /trunk/ccl/lib/ffi-darwinppc64.lisp	(revision 5759)
@@ -163,5 +163,5 @@
                                   
 
-(defun darwin64::expand-ff-call (callform args)
+(defun darwin64::expand-ff-call (callform args &key (arg-coerce #'null-coerce-foreign-arg) (result-coerce #'null-coerce-foreign-result))
   (let* ((result-type-spec (or (car (last args)) :void))
          (regbuf nil)
@@ -234,7 +234,7 @@
                       (progn
                         (argforms (foreign-type-to-representation-type ftype))
-                        (argforms arg-value-form)))))))
+                        (argforms (funcall arg-coerce arg-type-spec arg-value-form))))))))
             (argforms (foreign-type-to-representation-type result-type))
-            (let* ((call `(,@callform ,@(argforms))))
+            (let* ((call (funcall result-coerce result-type-spec `(,@callform ,@(argforms)))))
               (when structure-arg-temp
                 (setq call `(let* ((,structure-arg-temp (%null-ptr)))
