diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\ChangeLog uffi\ChangeLog
--- uffi-1.5.17\ChangeLog	Tue Oct 10 08:35:48 2006
+++ uffi\ChangeLog	Wed Aug 02 09:10:19 2006
@@ -1,16 +1,3 @@
-2006-10-10 Kevin Rosenberg (kevin@rosenberg.net)
-	* Version 1.5.17
-	* src/functions.lisp: Patch from Edi Weitz for Lispworks 5/Linux
-	
-2006-09-02 Kevin Rosenberg (kevin@rosenberg.net)
-	* Version 1.5.16
-	* src/libraries.lisp: Add cygwin support
-	
-2006-08-13 Kevin Rosenberg (kevin@rosenberg.net)
-	* Version 1.5.15
-	* src/{objects,strings}.lisp: Add support for Lispworks 5 
-	thanks to patches from Bill Atkins 
-
 2006-07-04 Kevin Rosenberg (kevin@rosenberg.net)
 	* Version 1.5.14
 	* src/{objects,strings}.lisp: Apply patch from Edi Weitz
Binary files uffi-1.5.17\doc\html.tar.gz and uffi\doc\html.tar.gz differ
Binary files uffi-1.5.17\examples\c-test-fns.dll and uffi\examples\c-test-fns.dll differ
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\examples\c-test-fns.dll.manifest uffi\examples\c-test-fns.dll.manifest
--- uffi-1.5.17\examples\c-test-fns.dll.manifest	Wed Dec 31 16:00:00 1969
+++ uffi\examples\c-test-fns.dll.manifest	Sat Jun 24 11:02:03 2006
@@ -0,0 +1,8 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
+    </dependentAssembly>
+  </dependency>
+</assembly>
Binary files uffi-1.5.17\examples\c-test-fns.lib and uffi\examples\c-test-fns.lib differ
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\examples\test-examples.lisp uffi\examples\test-examples.lisp
--- uffi-1.5.17\examples\test-examples.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\examples\test-examples.lisp	Fri Jun 30 09:20:56 2006
@@ -32,8 +32,8 @@
       (load-test "gettime")
       (load-test "getenv")
       (load-test "gethostname")
-      (load-test "getshells")
-      (load-test "compress"))
+      #-win32 (load-test "getshells")
+      #-win32 (load-test "compress"))
     (setq cl:*features* (remove :test-uffi cl:*features*))))
 
 (do-tests)
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\src\aggregates.lisp uffi\src\aggregates.lisp
--- uffi-1.5.17\src\aggregates.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\src\aggregates.lisp	Wed Oct 04 22:08:58 2006
@@ -44,6 +44,7 @@
 		       #+sbcl `((sb-alien:define-alien-type ,enum-name sb-alien:signed))
                        #+digitool `((def-mcl-type ,enum-name :integer))
                        #+openmcl `((ccl::def-foreign-type ,enum-name :int))
+               #+cormanlisp `((ct:defctype ,enum-name :long))
 		       (nreverse constants)))
     cmds))
 
@@ -65,9 +66,13 @@
   `(def-mcl-type ,name-array '(:array ,type))
   #+openmcl
   `(ccl::def-foreign-type ,name-array (:array ,(convert-from-uffi-type type :array)))
+  #+cormanlisp
+  `(ct:defctype ,name-array (,(convert-from-uffi-type type :array) *))
   )
 
 (defun process-struct-fields (name fields &optional (variant nil))
+  #+cormanlisp
+  (declare (ignore name))
   (let (processed)
     (dolist (field fields)
       (let* ((field-name (car field))
@@ -78,7 +83,8 @@
 			      #+sbcl `((* (sb-alien:struct ,name)))
 			      #+(or openmcl digitool) `((:* (:struct ,name)))
 			      #+lispworks `((:pointer ,name))
-			      #-(or cmu sbcl scl openmcl digitool lispworks) `((* ,name))
+                  #+cormanlisp `((:void *))
+			      #-(or cmu sbcl scl openmcl digitool lispworks cormanlisp) `((* ,name))
 			      `(,(convert-from-uffi-type type :struct))))))
 	(if variant
 	    (push (list def) processed)
@@ -101,6 +107,8 @@
   `(ccl::def-foreign-type
     nil 
     (:struct ,name ,@(process-struct-fields name fields)))
+  #+cormanlisp
+  `(c-types:defcstruct ,name (,@(process-struct-fields name fields)))
   )
 
 
@@ -116,6 +124,10 @@
   `(sb-alien:slot ,obj ,slot)
   #+(or openmcl digitool)
   `(ccl:pref ,obj ,(read-from-string (format nil ":~a.~a" (keyword type) (keyword slot))))
+  #+cormanlisp
+  (let ((corman-type (if (listp type) (cadr type) type))
+        (corman-slot (if (listp slot) (cadr slot) slot)))
+    `(ct:cref ,(convert-from-uffi-type corman-type :slot) ,obj ,corman-slot))
   )
 
 #+(or openmcl digitool)
@@ -141,13 +153,15 @@
   #+openmcl
   `(let ((field (ccl::%find-foreign-record-type-field ,type ,slot)))
      (ccl:%int-to-ptr (+ (ccl:%ptr-to-int ,obj) (the fixnum (ccl::foreign-record-field-offset field)))))  
+  #+cormanlisp
+  `(ct:cref ,type ,obj ,slot)
 )
 
 ;; necessary to eval at compile time for openmcl to compile convert-from-foreign-usb8
 ;; below
 (eval-when (:compile-toplevel :load-toplevel :execute)
   ;; so we could allow '(:array :long) or deref with other type like :long only
-  #+(or openmcl digitool)
+  #+(or openmcl digitool cormanlisp)
   (defun array-type (type)
     (let ((result type))
       (when (listp type)
@@ -180,6 +194,9 @@
       `(,accessor
 	,obj
 	(* (the fixnum ,i) ,(size-of-foreign-type local-type))))
+    #+cormanlisp
+      (let ((corman-type (convert-from-uffi-type (cadr type) :array)))
+        `(ct:cref ,corman-type ,obj ,i))
     ))
   
 ; this expands to the %set-xx functions which has different params than %put-xx
@@ -198,6 +215,8 @@
 (defsetf deref-array deref-array-set)
 
 (defmacro def-union (name &rest fields)
+  #+cormanlisp
+  (declare (ignore name fields))
   #+allegro
   `(ff:def-foreign-type ,name (:union ,@(process-struct-fields name fields)))
   #+lispworks
@@ -211,10 +230,12 @@
   #+openmcl
   `(ccl::def-foreign-type nil 
 			  (:union ,name ,@(process-struct-fields name fields)))
+  #+cormanlisp
+  `(error "Not implemented.")
 )
 
 
-#-(or sbcl cmu)
+#-(or sbcl cmu cormanlisp)
 (defun convert-from-foreign-usb8 (s len)
   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))
 	   (fixnum len))
@@ -260,3 +281,15 @@
 						vm:word-bits)
 				      (* len vm:byte-bits))
 	result))))
+
+#+cormanlisp
+(defun convert-from-foreign-usb8 (s len)
+  (let ((a (make-array len :element-type '(unsigned-byte 8))))
+    (dotimes (i len a)
+      (declare (fixnum i))
+      (setf (aref a i) (ct:cref (:unsigned-char 1) s i)))))
+
+(defmacro test-convert (type)
+  (let ((corman-type (uffi::convert-from-uffi-type (cadr type) :array)))
+    (print (cadr type))
+    (print corman-type)))
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\src\functions.lisp uffi\src\functions.lisp
--- uffi-1.5.17\src\functions.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\src\functions.lisp	Fri Oct 13 14:42:31 2006
@@ -47,7 +47,7 @@
     #+(or cmu sbcl scl)
     ;(list name type :in)
     `(,name ,type ,@(if (= (length arg) 3) (list (third arg)) (values)))
-    #+(or allegro lispworks digitool)
+    #+(or allegro lispworks digitool cormanlisp)
     (if (and (listp type) (listp (car type)))
 	(append (list name) type)
       (list name type))
@@ -113,6 +113,16 @@
 	(values (list (first names) fname) fname (second names)))))
 
 (defun preprocess-args (args)
+
+  "args to def-function can come either as simple (name type)
+lists or as (name type [:out|:in]).  When they come in the second
+form, this function takes them and reduces them to their (name
+type) form.  When :in, they are kept as value, when :out, they
+are converted to pointer types.  There are three return values.
+the first is a list of names used for parameters.  The second is
+a list of out parameters, and processed is a list of converted
+args to their true form."
+
   (loop for arg in args
 	with lisp-args = nil and out = nil and processed = nil
 	do
@@ -134,10 +144,32 @@
 				(nreverse processed)))))
 
 
-(defmacro def-function (names args &key module returning)
+(defmacro def-function (names args &key 
+                              module 
+                              returning 
+                              call-type)
+
+  "args: names - a string as the C function name (converted to a
+lisp symbol) or a list of (foreign lisp) names
+args - list of args, each one a list of (name type [:in|:out]).  :out parameters
+are converted to pointer types.
+module - shared library this function resides in.  See load-foreign-library.
+call-type - calling convention of the function, platform specific."
+
   (multiple-value-bind (lisp-args out processed)
       (preprocess-args args)
-    (declare (ignorable lisp-args processed))
+    #+cormanlisp (declare (ignore lisp-args out))
+    #+cormanlisp
+    (progn 
+      ;`(let ((filename (if ,module (cadr (assoc ,module *module-alist*)) *last-library-loaded*)))
+      (when (null module) (setf module "cstdlib"))
+      (let ((library-name (caadr (assoc module *module-alist* :test #'equalp)))
+            (call-type (if call-type call-type (cdadr (assoc module *module-alist* :test #'equalp)))))
+        `(%def-function ,names ,processed 
+                        :module ,(if library-name library-name module)
+                        :call-type ,call-type
+                        ,@(if returning (list :returning returning) (values)))))
+    #-cormanlisp
     (if (= (length out) 0)
 	`(%def-function ,names ,args 
 	  ,@(if module (list :module module) (values))
@@ -150,12 +182,12 @@
 	`(%def-function ,names ,(convert-lispworks-args args) 
 	  ,@(if module (list :module module) (values))
 	  ,@(if returning (list :returning returning) (values)))
-	#-(or cmu scl sbcl lispworks)
+	#-(or cmu scl sbcl lispworks cormanlisp)
 	(multiple-value-bind (name-pair fname lisp-name)
 	    (preprocess-names names)
 	  `(prog1
 	    (%def-function ,name-pair ,processed 
-	     :module ,module :returning ,returning)
+	     :module ,module :returning ,returning :call-type ,call-type)
 	    ;(declaim (inline ,fname))
 	    (defun ,lisp-name ,lisp-args
 	      (with-foreign-objects ,out
@@ -169,9 +201,8 @@
 
 ;; name is either a string representing foreign name, or a list
 ;; of foreign-name as a string and lisp name as a symbol
-(defmacro %def-function (names args &key module returning)
-  #+(or cmu sbcl scl allegro openmcl digitool cormanlisp) (declare (ignore module))
-  
+(defmacro %def-function (names args &key module returning call-type)
+  #+(or cmu sbcl scl allegro openmcl digitool) (declare (ignore module call-type))
   (let* ((result-type (convert-from-uffi-type returning :return))
 	 (function-args (process-function-args args))
 	 (foreign-name (if (atom names) names (car names)))
@@ -198,7 +229,7 @@
        ,@(if module (list :module module) (values))
        :result-type ,result-type
       :language :ansi-c
-       #+:win32 :calling-convention #+:win32 :cdecl)
+       #-macosx :calling-convention #-macosx :cdecl)
     #+digitool
     `(eval-when (:compile-toplevel :load-toplevel :execute)
        (ccl:define-entry-point (,lisp-name ,foreign-name)
@@ -213,13 +244,9 @@
       `(defun ,lisp-name ,params
          (ccl::external-call ,foreign-name ,@args ,result-type)))
     #+cormanlisp
-    `(ct:defun-dll ,lisp-name (,function-args)
+    `(ct:defun-dll ,lisp-name ,function-args
        :return-type ,result-type
-       ,@(if module (list :library-name module) (values))
+       :library-name ,module
        :entry-name ,foreign-name
-       :linkage-type ,calling-convention) ; we need :pascal
+       ,@(if call-type (list :linkage-type call-type) (list :linkage-type :c)))
     ))
-
-
-
-
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\src\libraries.lisp uffi\src\libraries.lisp
--- uffi-1.5.17\src\libraries.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\src\libraries.lisp	Sat Oct 14 13:01:12 2006
@@ -18,6 +18,23 @@
 (defvar *loaded-libraries* nil
   "List of foreign libraries loaded. Used to prevent reloading a library")
 
+#+cormanlisp
+(defvar *module-alist* nil
+  "list of filenames associated with a module name for load-foreign-library.
+Corman Lisp loads a shared library when a function from that library is defined/requested.
+load-foreign-library simply associates the two, so when def-function is called with a
+module, UFFI knows what library name to hand to defun-dll.")
+
+#+cormanlisp
+(defvar *last-library-loaded* nil
+  "last library loaded using load-foreign-library.  Since Corman Lisp doesn't first
+load the library then find the functions, we fake it by setting this variable.  If the
+module isn't specified when def-function is called, it uses this value to pass to Corman's
+foreign function definition function.")
+
+#+cormanlisp
+(require 'winbase)
+
 (defun default-foreign-library-type ()
   "Returns string naming default library type for platform"
   #+(or win32 cygwin mswindows) "dll"
@@ -44,7 +61,16 @@
     (setq names (list names)))
   (unless (listp directories)
     (setq directories (list directories)))
-  #+(or win32 mswindows)
+  #+cormanlisp
+  (unless (and (not (null drive-letters)) (listp drive-letters))
+    (if (null drive-letters)
+        ; go through the letter drives on the machine and add them to the drive-letters if it is empty
+        (let ((drive-mask (win:getlogicaldrives)))
+          (dotimes (bit 26 t)
+            (when (/= (logand drive-mask (expt 2 bit)) 0)
+                (setf drive-letters (cons (make-string 1 :initial-element (code-char (+ (char-code #\A) bit))) drive-letters)))))
+      (setq drive-letters (list drive-letters))))
+  #(and (or win32 mswindows) (not cormanlisp))
   (unless (listp drive-letters)
     (setq drive-letters (list drive-letters)))
   #-(or win32 mswindows)
@@ -71,15 +97,40 @@
 			   (parse-namestring dir)))))))
 	    (when (probe-file path)
 	      (return-from find-foreign-library path)))))))
+   ; if we've reached here, then Corman just tries to load it and then get the filename
+   ; from the loaded library.  This works for SxS DLLs
+   #+cormanlisp
+   (dolist (name names)
+     (let ((handle (win32:LoadLibrary name))
+           buf
+           (path nil))
+       (if handle
+           (progn
+             (setf buf (ct:malloc 256))
+             (win32:GetModuleFileName handle buf 256)
+             (setf path (make-pathname :name (ct:c-string-to-lisp-string buf)))
+             (ct:free buf)
+             (win32:FreeLibrary handle)))
+       (return-from find-foreign-library path)))
    nil)
 
 
 (defun load-foreign-library (filename &key module supporting-libraries
-					   force-load)
+                                      force-load 
+                                      #+cormanlisp (call-type :pascal) 
+                                      #-cormanlisp call-type)
+  "load a foreign library so that functions may be called in it using def-function.
+args:
+filename - pathname of the shared library to load (can be found using find-foreign-library)
+module - tag which this library will be known in def-function calls
+supporting-libraries - libraries that have to be loaded with this one
+force-load - load again even if already loaded
+call-type - calling convention of functions defined in this library.  Can be overridden in def-function."
   #+(or allegro openmcl digitool sbcl) (declare (ignore module supporting-libraries))
   #+(or cmu scl) (declare (ignore module))
-  #+lispworks (declare (ignore supporting-libraries))
-
+  #+(or cormanlisp lispworks) (declare (ignore supporting-libraries))
+  #+cormanlisp
+  (unless module (error "Must identify this library with a module name using :module"))
   (when (and filename (or (null (pathname-directory filename))
                           (probe-file filename)))
     (if (pathnamep filename)    ;; ensure filename is a string to check if already loaded
@@ -91,7 +142,11 @@
 
     (if (and (not force-load)
 	     (find filename *loaded-libraries* :test #'string-equal))
-	t ;; return T, but don't reload library
+        #+cormanlisp
+      (progn
+        (setf *last-library-loaded* filename)
+        t)
+      #-cormanlisp t ;; return T, but don't reload library
       (progn
 	#+cmu
 	(let ((type (pathname-type (parse-namestring filename))))
@@ -119,7 +174,10 @@
 	#+allegro (load filename)
 	#+openmcl (ccl:open-shared-library filename)
 	#+digitool (ccl:add-to-shared-library-search-path filename t)
-
+    #+cormanlisp 
+    (progn
+      (pushnew (cons module (list (cons filename call-type))) *module-alist* :key #'car)
+      (setf *last-library-loaded* filename))
 	(push filename *loaded-libraries*)
 	t))))
 
@@ -128,3 +186,11 @@
     (dolist (lib libs)
       (push (format nil "-l~A" lib) lib-load-list))
     (nreverse lib-load-list)))
+
+;;; automatically load the C library for Corman Lisp
+#+cormanlisp
+(load-foreign-library 
+ (find-foreign-library "msvcr80" 
+                       '("/windows/" "/windows/system32/") 
+                       :drive-letters '("C"))
+ :module "cstdlib" :call-type :c)
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\src\objects.lisp uffi\src\objects.lisp
--- uffi-1.5.17\src\objects.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\src\objects.lisp	Mon Sep 11 22:10:09 2006
@@ -28,6 +28,7 @@
 	  (ccl::mactype-record-size mcl-type)
 	  (ccl::record-descriptor-length (ccl:find-record-descriptor type t t)))) ;error if not a record
     #+openmcl (ccl::%foreign-type-or-record-size type :bytes)
+    #+cormanlisp (ct:sizeof type)   ; jk - use just type here since the other implementations do.  Perhaps they already call (convert-from-uffi-type before calling this.
     ))
 
 (defmacro allocate-foreign-object (type &optional (size :unspecified))
@@ -45,6 +46,9 @@
 	`(ff:allocate-fobject ',(convert-from-uffi-type type :allocate) :c)
 	#+(or openmcl digitool)
 	`(new-ptr ,(size-of-foreign-type (convert-from-uffi-type type :allocation)))
+    #+cormanlisp
+    (let ((corman-type (if (listp type) (cadr type) type)))
+       `(ct:malloc (ct:sizeof ',(convert-from-uffi-type corman-type :allocation))))
 	)
       (progn
 	#+(or cmu scl)
@@ -57,6 +61,9 @@
 	`(ff:allocate-fobject (list :array (quote ,(convert-from-uffi-type type :allocate)) ,size) :c)
 	#+(or openmcl digitool)
 	`(new-ptr (* ,size ,(size-of-foreign-type (convert-from-uffi-type type :allocation))))
+    #+cormanlisp
+    (let ((corman-type (if (listp type) (cadr type) type)))
+      `(ct:malloc (* ,size (ct:sizeof ',(convert-from-uffi-type corman-type :allocation)))))
 	)))
 
 (defmacro free-foreign-object (obj)
@@ -70,6 +77,8 @@
   `(ff:free-fobject ,obj)
   #+(or openmcl digitool)
   `(dispose-ptr ,obj)
+  #+cormanlisp
+  `(unless (ct:cpointer-null ,obj) (ct:free ,obj))
   )
 
 (defmacro null-pointer-p (obj)
@@ -78,24 +87,27 @@
   #+(or cmu scl)   `(alien:null-alien ,obj)
   #+sbcl   `(sb-alien:null-alien ,obj)
   #+(or openmcl digitool)   `(ccl:%null-ptr-p ,obj)
+  #+cormanlisp `(ct:cpointer-null ,obj)
   )
 
 (defmacro make-null-pointer (type)
-  #+(or allegro openmcl digitool) (declare (ignore type))
+  #+(or allegro openmcl digitool cormanlisp) (declare (ignore type))
   #+(or cmu scl) `(alien:sap-alien (system:int-sap 0) (* ,(convert-from-uffi-type (eval type) :type)))
   #+sbcl `(sb-alien:sap-alien (sb-sys:int-sap 0) (* ,(convert-from-uffi-type (eval type) :type)))
   #+lispworks `(fli:make-pointer :address 0 :type (quote ,(convert-from-uffi-type (eval type) :type)))
   #+allegro 0
   #+(or openmcl digitool) `(ccl:%null-ptr)
+  #+cormanlisp `(ct:create-foreign-ptr) ;; corman initializes to null already
   )
 
 (defmacro make-pointer (addr type)
-  #+(or allegro openmcl digitool) (declare (ignore type))
+  #+(or allegro openmcl digitool cormanlisp) (declare (ignore type))
   #+(or cmu scl) `(alien:sap-alien (system:int-sap ,addr) (* ,(convert-from-uffi-type (eval type) :type)))
   #+sbcl `(sb-alien:sap-alien (sb-sys:int-sap ,addr) (* ,(convert-from-uffi-type (eval type) :type)))
   #+lispworks `(fli:make-pointer :address ,addr :type (quote ,(convert-from-uffi-type (eval type) :type)))
   #+allegro addr
   #+(or openmcl digitool) `(ccl:%int-to-ptr ,addr)
+  #+cormanlisp `(ct:int-to-foreign-ptr ,addr)
   )
 
 
@@ -105,7 +117,7 @@
   #+lispworks `(fli:make-pointer :type '(:unsigned :char)
 				:address (fli:pointer-address ,obj))
   #+allegro obj
-  #+(or openmcl digitool) obj
+  #+(or openmcl digitool cormanlisp) obj
   )
 
 (defmacro deref-pointer (ptr type)
@@ -116,6 +128,9 @@
   #+lispworks `(fli:dereference ,ptr)
   #+allegro `(ff:fslot-value-typed (quote ,(convert-from-uffi-type type :deref)) :c ,ptr)
   #+(or openmcl digitool) `(ccl:pref ,ptr ,(convert-from-uffi-type type :deref))
+  #+cormanlisp 
+  (let ((corman-type (if (listp type) `(* ,(cadr type)) `(* ,type))))
+    `(ct:cref ,(convert-from-uffi-type corman-type :deref) ,ptr 0))
   )
 
 #+digitool
@@ -127,7 +142,7 @@
 
 (defmacro ensure-char-character (obj)
   #+(or digitool) obj
-  #+(or allegro cmu sbcl scl openmcl) `(code-char ,obj)
+  #+(or allegro cmu sbcl scl openmcl cormanlisp) `(code-char ,obj)
   ;; lispworks varies whether deref'ing array vs. slot access of a char
   #+lispworks `(if (characterp ,obj) ,obj (code-char ,obj)))
 
@@ -135,13 +150,12 @@
   #+(or digitool) `(char-code ,obj)
   #+(or allegro cmu sbcl scl openmcl) obj
   ;; lispworks varies whether deref'ing array vs. slot access of a char
-  #+lispworks
+  #+(or lispworks cormanlisp)
   `(if (integerp ,obj) ,obj (char-code ,obj)))
 
 (defmacro ensure-char-storable (obj)
-  #+(or digitool (and lispworks (not lispworks5))) obj
-  #+(or allegro cmu lispworks5 openmcl sbcl scl)
-  `(char-code ,obj))
+  #+(or lispworks digitool) obj
+  #+(or allegro cmu sbcl scl openmcl cormanlisp) `(char-code ,obj))
 
 (defmacro pointer-address (obj)
   #+(or cmu scl)
@@ -154,6 +168,7 @@
   obj
   #+(or openmcl digitool)
   `(ccl:%ptr-to-int ,obj)
+  #+cormanlisp `(ct:foreign-ptr-to-int ,obj)
   )
 
 ;; TYPE is evaluated.
@@ -231,13 +246,13 @@
            ,pointer (* ,(convert-from-uffi-type (eval type) :type)))))
     ,@body))
 
-#+(or allegro openmcl)
+#+(or allegro openmcl cormanlisp)
 (defmacro with-cast-pointer ((binding-name pointer type) &body body)
   (declare (ignore type))
   `(let ((,binding-name ,pointer))
     ,@body))
 
-#-(or lispworks cmu scl sbcl allegro openmcl)
+#-(or lispworks cmu scl sbcl allegro openmcl cormanlisp)
 (defmacro with-cast-pointer ((binding-name pointer type) &body body)
   (declare (ignore binding-name pointer type body))
   '(error "WITH-CAST-POINTER not (yet) implemented for ~A"
@@ -250,11 +265,12 @@
   #-(or macosx darwinppc-target) name)
 
 (defmacro def-foreign-var (names type module)
-  #-lispworks (declare (ignore module))
+  #-(or cormanlisp lispworks) (declare (ignore module))
   (let ((foreign-name (if (atom names) names (first names)))
         (lisp-name (if (atom names) (make-lisp-name names) (second names)))
         #-allegro
-        (var-type (convert-from-uffi-type type :type)))
+        (var-type (uffi::convert-from-uffi-type type :type))
+        )
     #+(or cmu scl)
     `(alien:def-alien-variable (,foreign-name ,lisp-name) ,var-type)
     #+sbcl
@@ -275,7 +291,22 @@
     `(define-symbol-macro ,lisp-name
        (deref-pointer (ccl:foreign-symbol-address
                        ,(convert-external-name foreign-name)) ,var-type))
-    #-(or allegro cmu scl sbcl lispworks openmcl)
+    #+cormanlisp
+    (if (not module)
+        (error "module keyword must be defined for Corman Lisp")
+      (let ((fptr (intern (concatenate 'string (symbol-name lisp-name) "-FPTR"))))
+        `(progn
+           (defvar ,fptr 
+             (ct::get-dll-function-address
+              (caadr (assoc ,module uffi::*module-alist* :test #'equalp)) ,foreign-name))
+           (define-symbol-macro ,lisp-name (ct:cref (,var-type *) ,fptr 0)))))
+;; this works, but is too inefficient
+;;          `(define-symbol-macro ,lisp-name 
+;;             (ct:cref (,var-type *) 
+;;              (ct::get-dll-function-address 
+;;               (caadr 
+;;                (assoc ,module uffi::*module-alist* :test #'equalp)) ,foreign-name) 0)))
+    #-(or allegro cmu scl sbcl lispworks openmcl cormanlisp)
     `(define-symbol-macro ,lisp-name
       '(error "DEF-FOREIGN-VAR not (yet) defined for ~A"
         (lisp-implementation-type)))))
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\src\os.lisp uffi\src\os.lisp
--- uffi-1.5.17\src\os.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\src\os.lisp	Sat Jul 08 16:24:50 2006
@@ -37,9 +37,11 @@
   "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
 synchronously execute the result using a Bourne-compatible shell, with
 output to *trace-output*.  Returns the shell's exit code."
+  #+cormanlisp (declare (ignore control-string args output))
   (unless output
     (setq output *trace-output*))
 
+  #-cormanlisp
   (let ((command (apply #'format nil control-string args)))
     #+sbcl
     (sb-impl::process-exit-code
@@ -73,7 +75,7 @@
 		(ccl:run-program "/bin/sh" (list "-c" command)
 				 :input nil :output output
 				 :wait t)))
-
+    )
     #-(or openmcl clisp lispworks allegro scl cmu sbcl)
-    (error "RUN-SHELL-PROGRAM not implemented for this Lisp.")
-    ))
+    (error "RUN-SHELL-COMMAND not implemented for this Lisp.")
+    )
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\src\primitives.lisp uffi\src\primitives.lisp
--- uffi-1.5.17\src\primitives.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\src\primitives.lisp	Wed Oct 04 21:52:13 2006
@@ -159,7 +159,7 @@
       (:float . sb-alien:float) (:double . sb-alien:double)
       (:array . sb-alien:array)))
 
-#+(or allegro cormanlisp)
+#+allegro
 (setq *type-conversion-list*
     '((* . *) (:void . :void)
       (:short . :short)
@@ -174,6 +174,21 @@
       (:float . :float) (:double . :double)
       (:array . :array)))
 
+#+cormanlisp
+(setq *type-conversion-list*
+    '((* . *) (:void . :void)
+      (:short . :short)
+      (:pointer-void . (:void *))
+      (:cstring . (:char *))
+      (:byte . :char)
+      (:unsigned-byte . :unsigned-char)
+      (:char . :char)
+      (:unsigned-char . :unsigned-char)
+      (:int . :long) (:unsigned-int . :unsigned-long) 
+      (:long . :long) (:unsigned-long . :unsigned-long)
+      (:float . :single-float) (:double . :double-float)
+      (:array . ())))
+
 #+lispworks
 (setq *type-conversion-list*
     '((* . :pointer) (:void . :void) 
@@ -237,11 +252,12 @@
       #-(or openmcl digitool) type
       #+(or openmcl digitool) (keyword type))))
 
+#-cormanlisp
 (defun %convert-from-uffi-type (type context)
   "Converts from a uffi type to an implementation specific type"
   (if (atom type)
       (cond
-       #+(or allegro cormanlisp)
+       #+(or allegro)
        ((and (or (eq context :routine) (eq context :return))
 	     (eq type :cstring))
 	(setq type '((* :char) integer)))
@@ -279,7 +295,36 @@
 	(cons (%convert-from-uffi-type (first type) context) 
 	      (%convert-from-uffi-type (rest type) context)))))))
 
+#+cormanlisp
+(defun %convert-from-uffi-type (type context)
+  "Convert from UFFI type to Corman Lisp type
+Most of the types are 1 to 1 regarding primitive types.
+For pointer types, Corman takes the * after the type whereas UFFI takes it before.
+For arrays, UFFI = (:array <type> <len>) and Corman is simply (<type> <len>).
+Structures are nearly identical.
+Contexts are ignored."
+  (if (atom type)
+      (basic-convert-from-uffi-type type)
+    (cond ((eq (car type) :array) 
+           (list (convert-from-uffi-type (cadr type) context) 
+                 ; if there is a length, then put that in next, else put in a * for a pointer
+                 (let ((len (caddr type)))
+                   (if len
+                       len
+                     '*))))
+          ((eq (car type) '*)
+           (list (convert-from-uffi-type (cdr type) context) '*))
+          ((eq (car type) :struct)
+           (cadr type))
+          ((eq (car type) :struct-pointer)
+           (list (cadr type) '*))
+          ((atom (car type))
+           (convert-from-uffi-type (car type) context))
+          ((eq (car type) :union)
+           (error "Unions are not implemented in Corman Lisp.")))))
+
 (defun convert-from-uffi-type (type context)
+  "Convert from UFFI type to implementation specific FFI type."
   (let ((result (%convert-from-uffi-type type context)))
     (cond
      ((atom result) result)
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\src\strings.lisp uffi\src\strings.lisp
--- uffi-1.5.17\src\strings.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\src\strings.lisp	Fri Oct 06 22:30:52 2006
@@ -20,6 +20,7 @@
     #+allegro 0
     #+lispworks (fli:make-pointer :address 0 :type '(:unsigned :char))
     #+(or openmcl digitool) (ccl:%null-ptr)
+    #+cormanlisp (ct:create-foreign-ptr)
 )
 
 (defmacro convert-from-cstring (obj)
@@ -38,6 +39,8 @@
        (if (ccl:%null-ptr-p ,stored)
 	   nil
 	 (values (ccl:%get-cstring ,stored)))))
+  #+cormanlisp
+  `(unless (ct:cpointer-null ,obj) (ct:c-string-to-lisp-string ,obj))
   )
 
 (defmacro convert-to-cstring (obj)
@@ -56,6 +59,8 @@
 	   (let ((ptr (new-ptr (1+ (length ,stored)))))
 	     (ccl::%put-cstring ptr ,stored)
 	     ptr))))
+  #+cormanlisp
+  `(ct:lisp-string-to-c-string ,obj)
   )
 
 (defmacro free-cstring (obj)
@@ -70,6 +75,8 @@
     `(let ((,stored ,obj))
        (unless (ccl:%null-ptr-p ,stored)
 	 (dispose-ptr ,stored))))
+  #+cormanlisp
+  `(unless (ct:cpointer-null ,obj) (ct:free ,obj))
   )
 
 (defmacro with-cstring ((cstring lisp-string) &body body)
@@ -90,6 +97,9 @@
 	     ,@body)
 	   (let ((,cstring +null-cstring-pointer+))
 	     ,@body))))
+  #+cormanlisp
+  `(let ((,cstring (ct:lisp-string-to-c-string ,lisp-string)))
+     ,@body)
   )
 
 (defmacro with-cstrings (bindings &rest body)
@@ -166,6 +176,8 @@
 	   (let ((ptr (new-ptr (1+ (length ,stored-obj)))))
 	     (ccl::%put-cstring ptr ,stored-obj)
 	     ptr))))
+  #+cormanlisp
+  `(ct:lisp-string-to-c-string ,obj)
   )
 
 ;; Either length or null-terminated-p must be non-nil
@@ -173,6 +185,8 @@
 					   length
 					   (locale :default)
 					   (null-terminated-p t))
+  #+cormanlisp
+  (declare (ignore length locale null-terminated-p))
   #+allegro
   (let ((stored-obj (gensym)))
     `(let ((,stored-obj ,obj))
@@ -227,6 +241,8 @@
 	   #+openmcl ,@(if length
 			   `((ccl:%str-from-ptr ,stored-obj ,length))
 			   `((ccl:%get-cstring ,stored-obj))))))
+  #+cormanlisp
+  `(unless (ct:cpointer-null ,obj) (ct:c-string-to-lisp-string ,obj))
   )
 
 
@@ -261,15 +277,18 @@
   (declare (ignore unsigned))
   #+allegro
   `(ff:allocate-fobject :char :c ,size)
-  #+(or openmcl digitool)
+  #+(or openmcl digitool cormanlisp)
   (declare (ignore unsigned))
   #+(or openmcl digitool)
   `(new-ptr ,size)
+  #+cormanlisp
+  `(ct:malloc ,size)
   )
 
 (defun foreign-string-length (foreign-string)
   #+allegro `(ff:foreign-strlen ,foreign-string)
-  #-allegro
+  #+cormanlisp `(ct:c-string-length ,foreign-string)
+  #-(or allegro cormanlisp)
   `(loop with size = 0
     until (char= (deref-array ,foreign-string '(:array :unsigned-char) size) #\Null)
     do (incf size)
@@ -383,13 +402,20 @@
 
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
+  #-cormanlisp
+   (def-function "strlen"
+     ((str (* :unsigned-char)))
+     :returning :unsigned-int)
+   #+cormanlisp
    (def-function "strlen"
      ((str (* :unsigned-char)))
-     :returning :unsigned-int))
+     :module "cstdlib"
+     :returning :unsigned-long
+     :call-type :c))
 
 (def-type char-ptr-def (* :unsigned-char))
 
-#+(or (and allegro (not ics)) (and lispworks (not lispworks5)))
+#+(or lispworks (and allegro (not ics)))
 (defun fast-native-to-string (s len)
   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))
 	   (type char-ptr-def s))
@@ -402,7 +428,7 @@
       (setf (aref str i)
 	(uffi:deref-array s '(:array :char) i)))))
 
-#+(or (and allegro ics) lispworks5)
+#+(and allegro ics)
 (defun fast-native-to-string (s len)
   (declare (optimize (speed 3) (space 0) (safety 0) (compilation-speed 0))
 	   (type char-ptr-def s))
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\compress.lisp uffi\tests\compress.lisp
--- uffi-1.5.17\tests\compress.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\tests\compress.lisp	Fri Oct 13 16:40:13 2006
@@ -21,7 +21,8 @@
      (source :cstring)
      (source-len :long))
   :returning :int
-  :module "zlib")
+  :module "zlib"
+  :call-type :c)
   
 (defun compress (source)
   "Returns two values: array of bytes containing the compressed data
@@ -50,7 +51,8 @@
      (source :cstring)
      (source-len :long))
   :returning :int
-  :module "zlib")
+  :module "zlib"
+  :call-type :c)
 
 (defun uncompress (source)
   (let* ((sourcelen (length source))
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\foreign-loader.lisp uffi\tests\foreign-loader.lisp
--- uffi-1.5.17\tests\foreign-loader.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\tests\foreign-loader.lisp	Mon Sep 11 22:13:58 2006
@@ -16,16 +16,38 @@
 ;;; For CMUCL, it's necessary to load foreign files separate from their
 ;;; usage
 
-(in-package uffi-tests)
+; on windows, as long as these files are in the path or the directory where
+; the tests are being run, the dll will be found, despite the directory not
+; being in the find-foreign-library call.
+
+(in-package #:uffi-tests)
+
+; load the C standard library for Windows
+#+(and cormanlisp win32)
+(unless (uffi:load-foreign-library
+         (uffi:find-foreign-library
+          "msvcrt" '("/windows/" "/windows/system32/"))
+         :module "cstdlib" :call-type :c)
+  (warn "Unable to load MSVCRT C Runtime DLL"))
+
+; load the winsock dll for windows
+#+(and cormanlisp win32)
+(unless (uffi:load-foreign-library
+         (uffi:find-foreign-library
+          "ws2_32" '("/windows/" "/windows/system32/"))
+         :module "sockets" :call-type :pascal)
+  (warn "Unable to load sockets dll"))
 
 #+clisp (uffi:load-foreign-library "/usr/lib/libz.so" :module "z")
 #-clisp
 (unless (uffi:load-foreign-library
 	 (uffi:find-foreign-library
-	  #-(or macosx darwin)
+	  #-(or macosx darwin win32 mswindows)
 	  "libz"
 	  #+(or macosx darwin)
 	  "z"
+      #+(or win32 mswindows)
+      "zlib"
 	  (list (pathname-directory *load-pathname*)
 		"/usr/local/lib/" #+(or 64bit x86-64) "/usr/lib64/"
 		"/usr/lib/" "/zlib/"))
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\getenv.lisp uffi\tests\getenv.lisp
--- uffi-1.5.17\tests\getenv.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\tests\getenv.lisp	Wed Jul 12 17:45:23 2006
@@ -20,15 +20,37 @@
     ((name :cstring))
   :returning :cstring)
 
+#-win32
 (uffi:def-function ("setenv" c-setenv) 
     ((name :cstring)
      (value :cstring)
      (overwrite :int))
   :returning :int)
 
+#-win32
 (uffi:def-function ("unsetenv" c-unsetenv)
     ((name :cstring))
   :returning :void)
+
+#+win32
+(uffi:def-function ("_putenv" c-putenv)
+                   ((name :cstring))
+                   :returning :int)
+
+#+win32
+(defun c-unsetenv (name)
+  (let ((envstr (concatenate 'string (uffi:convert-from-cstring name) "=")))
+    (c-putenv (uffi:convert-to-cstring envstr))))
+
+#+win32
+(defun c-setenv (name value overwrite)
+  (let ((envstr (uffi:convert-to-cstring 
+                 (concatenate 'string 
+                              (uffi:convert-from-cstring name) "=" (uffi:convert-from-cstring value)))))
+    (if overwrite
+        (c-putenv envstr)
+      (if (uffi:null-pointer-p (c-getenv name))
+            (c-putenv envstr)))))
 
 (defun my-getenv (key)
   "Returns an environment variable, or NIL if it does not exist"
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\gethostname.lisp uffi\tests\gethostname.lisp
--- uffi-1.5.17\tests\gethostname.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\tests\gethostname.lisp	Tue Jul 11 23:33:56 2006
@@ -16,13 +16,21 @@
 (in-package #:uffi-tests)
 
 
+#-cormanlisp
+(defconstant call-type :c)
+
+#+cormanlisp
+(defconstant call-type :pascal)
+
 ;;; This example is inspired by the example on the CL-Cookbook web site
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (uffi:def-function ("gethostname" c-gethostname) 
       ((name (* :unsigned-char))
        (len :int))
-    :returning :int)
+    :module "sockets"
+    :returning :int
+    :call-type call-type)
   
   (defun gethostname ()
     "Returns the hostname"
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\time.lisp uffi\tests\time.lisp
--- uffi-1.5.17\tests\time.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\tests\time.lisp	Thu Jul 13 07:58:36 2006
@@ -86,6 +86,8 @@
 	  (uffi:get-slot-value tv 'timeval 'usecs))
        res))))
 
+; Windows doesn't have the gettimeofday function
+#-win32
 (deftest :timeofday.1
     (multiple-value-bind (t1 res1) (get-utime)
       (multiple-value-bind (t2 res2) (get-utime)
@@ -107,4 +109,5 @@
 
 (deftest :time.3
     (posix-time-to-asctime 0)
-  "Thu Jan  1 00:00:00 1970")
+  #-win32 "Thu Jan  1 00:00:00 1970"
+  #+win32 "Thu Jan 01 00:00:00 1970") ; go figure, Corman returns a 01 instead of just 1.
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\uffi-c-test-lib.lisp uffi\tests\uffi-c-test-lib.lisp
--- uffi-1.5.17\tests\uffi-c-test-lib.lisp	Tue Oct 10 08:35:48 2006
+++ uffi\tests\uffi-c-test-lib.lisp	Fri Oct 13 16:39:05 2006
@@ -19,7 +19,8 @@
 (uffi:def-function ("cs_to_upper" cs-to-upper)
   ((input (* :unsigned-char)))
   :returning :void
-  :module "uffi_tests")
+  :module "uffi_tests"
+  :call-type :c)
 
 (defun string-to-upper (str)
   (uffi:with-foreign-string (str-foreign str)
@@ -29,7 +30,8 @@
 (uffi:def-function ("cs_count_upper" cs-count-upper)
   ((input :cstring))
   :returning :int
-  :module "uffi_tests")
+  :module "uffi_tests"
+  :call-type :c)
 
 (defun string-count-upper (str)
   (uffi:with-cstring (str-cstring str)
@@ -39,7 +41,8 @@
     ((size :int)
      (vec (* :double)))
   :returning :void
-  :module "uffi_tests")
+  :module "uffi_tests"
+  :call-type :c)
 
 (uffi:def-function ("return_long_negative_one" return-long-negative-one)
     ()
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\uffi-c-test.c uffi\tests\uffi-c-test.c
--- uffi-1.5.17\tests\uffi-c-test.c	Tue Oct 10 08:35:48 2006
+++ uffi\tests\uffi-c-test.c	Tue Jul 18 21:18:15 2006
@@ -17,6 +17,8 @@
 #ifdef WIN32
 #include <windows.h>
 
+#pragma pack( 1 )   // make :fvarst4 test work
+
 BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll,
                           DWORD fdwReason,
                           LPVOID lpvReserved)
@@ -143,7 +145,7 @@
   double d;
 } fvar_struct_type;
 
-fvar_struct_type fvar_struct = {42, 3.2};
+DLLEXPORT fvar_struct_type fvar_struct = {42, 3.2};
 
 DLLEXPORT
 int fvar_struct_int () {
Binary files uffi-1.5.17\tests\uffi-c-test.dll and uffi\tests\uffi-c-test.dll differ
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\tests\uffi-c-test.dll.manifest uffi\tests\uffi-c-test.dll.manifest
--- uffi-1.5.17\tests\uffi-c-test.dll.manifest	Wed Dec 31 16:00:00 1969
+++ uffi\tests\uffi-c-test.dll.manifest	Tue Jul 18 21:13:05 2006
@@ -0,0 +1,8 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
+    </dependentAssembly>
+  </dependency>
+</assembly>
Binary files uffi-1.5.17\tests\uffi-c-test.lib and uffi\tests\uffi-c-test.lib differ
Binary files uffi-1.5.17\tests\zlib.dll and uffi\tests\zlib.dll differ
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\uffi-allegro-test.lisp uffi\uffi-allegro-test.lisp
--- uffi-1.5.17\uffi-allegro-test.lisp	Wed Dec 31 16:00:00 1969
+++ uffi\uffi-allegro-test.lisp	Fri Oct 13 17:19:24 2006
@@ -0,0 +1,10 @@
+;(require 'winbase)
+;(require 'asdf-patch)
+(require '#:asdf)
+;(require 'asdf-addons)
+(pushnew #p"C:/dev/uffi/" asdf:*central-registry*)
+(asdf:operate 'asdf:load-op '#:uffi)
+;(use-package '#:uffi)
+(asdf:operate 'asdf:load-op '#:uffi-tests)
+(use-package '#:uffi-tests)
+(rt:do-tests)
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\uffi-corman-test.lisp uffi\uffi-corman-test.lisp
--- uffi-1.5.17\uffi-corman-test.lisp	Wed Dec 31 16:00:00 1969
+++ uffi\uffi-corman-test.lisp	Sat Sep 02 15:39:46 2006
@@ -0,0 +1,12 @@
+(require 'winbase)
+(require 'asdf-patch)
+(require 'asdf)
+(require 'asdf-addons)
+(pushnew 'asdf-util:source-dir-search
+         asdf:*system-definition-search-functions*)
+(pushnew #p"C:/dev/uffi" asdf-util:*source-dirs* :test #'equal)
+;(asdf:operate 'asdf:load-op '#:uffi)
+;(use-package '#:uffi)
+(asdf:operate 'asdf:load-op '#:uffi-tests)
+(use-package '#:uffi-tests)
+(rt:do-tests)
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\uffi-tests.asd uffi\uffi-tests.asd
--- uffi-1.5.17\uffi-tests.asd	Wed Jun 08 15:51:30 2005
+++ uffi\uffi-tests.asd	Wed Jul 19 12:45:34 2006
@@ -66,30 +66,31 @@
 	     (> (file-write-date lib) (file-write-date (component-pathname c)))))))
 
 (defsystem uffi-tests
-    :depends-on (:uffi)
+    :depends-on (#:uffi)
     :components
     ((:module tests
 	      :components
 	      ((:file "rt")
 	       (:file "package" :depends-on ("rt"))
 	       (:uffi-test-source-file "uffi-c-test" :depends-on ("package"))
-	       (:file "strtol" :depends-on ("package"))
-	       (:file "atoifl" :depends-on ("package"))
-	       (:file "getenv" :depends-on ("package"))
-	       (:file "gethostname" :depends-on ("package"))
-	       (:file "union" :depends-on ("package"))
+	       (:file "foreign-loader" :depends-on ("package" "uffi-c-test"))
+	       (:file "strtol" :depends-on ("foreign-loader"))
+	       (:file "atoifl" :depends-on ("foreign-loader"))
+	       (:file "getenv" :depends-on ("foreign-loader"))
+	       (:file "gethostname" :depends-on ("foreign-loader"))
+           #-cormanlisp (:file "union" :depends-on ("package"))
 	       (:file "arrays" :depends-on ("package"))
 	       (:file "structs" :depends-on ("package"))
 	       (:file "objects" :depends-on ("package"))
 	       (:file "time" :depends-on ("package"))
-	       (:file "foreign-loader" :depends-on ("package" "uffi-c-test"))
 	       (:file "uffi-c-test-lib" :depends-on ("foreign-loader"))
 	       (:file "compress" :depends-on ("foreign-loader"))
 	       (:file "casts" :depends-on ("foreign-loader"))
 	       (:file "foreign-var" :depends-on ("foreign-loader"))
 	       ))))
 
-(defmethod perform ((o test-op) (c (eql (find-system :uffi-tests))))
+(defmethod perform ((o test-op) (c (eql (find-system '#:uffi-tests))))
+  (format t "perform specific~%")
   (or (funcall (intern (symbol-name '#:do-tests)
 		       (find-package '#:regression-test)))
       (error "test-op failed")))
diff -NrubB --exclude=.svn --exclude=*.fasl --exclude=*.*~ --exclude=*.bak uffi-1.5.17\uffi.asd uffi\uffi.asd
--- uffi-1.5.17\uffi.asd	Mon Apr 17 18:07:10 2006
+++ uffi\uffi.asd	Fri Jun 23 22:53:18 2006
@@ -35,7 +35,7 @@
 	     (:file "objects" :depends-on ("primitives"))
 	     (:file "aggregates" :depends-on ("primitives"))
 	     (:file "strings" :depends-on ("primitives" "functions" "aggregates" "objects"))
-	     (:file "functions" :depends-on ("primitives"))
+	     (:file "functions" :depends-on ("primitives" "libraries"))
 	     (:file "libraries" :depends-on ("package"))
 	     (:file "os" :depends-on ("package"))))
    ))

