The with-foreign-slots
macro creates local symbol macros for
each var in vars to reference foreign slots in ptr of
type. It is similar to Common Lisp's with-slots
macro.
(defcstruct tm (sec :int) (min :int) (hour :int) (mday :int) (mon :int) (year :int) (wday :int) (yday :int) (isdst :boolean) (zone :string) (gmtoff :long)) CFFI> (with-foreign-object (time :int) (setf (mem-ref time :int) (foreign-funcall "time" :pointer (null-pointer) :int)) (foreign-funcall "gmtime" :pointer time tm)) => #<A Mac Pointer #x102A30> CFFI> (with-foreign-slots ((sec min hour mday mon year) * tm) (format nil "~A:~A:~A, ~A/~A/~A" hour min sec (+ 1900 year) mon mday)) => "7:22:47, 2005/8/2"