i've tried to quickly fix this, but it needs more then a simple combination of eval-when's.
my try was something like this:
(PROGN (EVAL-WHEN (:COMPILE-TOPLEVEL) (ENSURE-FOREIGN-TYPE _-OFF-64-T 'FOREIGN-TYPEDEF)) (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (LET* ((BTYPE (PARSE-TYPE '_-QUAD-T)) (DTYPE (IF (TYPEP BTYPE 'ENHANCED-FOREIGN-TYPE) 'ENHANCED-TYPEDEF 'FOREIGN-TYPEDEF)) (PARSER (ENSURE-FOREIGN-TYPE _-OFF-64-T DTYPE))) (SETF (NAME PARSER) '_-OFF-64-T) (SETF (ACTUAL-TYPE PARSER) BTYPE))))
but the problem is that even at load time we need to (?) call parse type and it may cause problems (?) if it happens in the wrong order. so it needs someone who has better understanding of the type stuff.
if this solution can work, here's where i've stopped:
;; this is instead of notice-foreign-type (defmacro ensure-foreign-type (name parser-type &rest initargs) (with-unique-names (parser) `(let (,parser (find-type-parser ',name)) (if ,parser (unless (typep ,parser ,parser-type) (change-class ,parser ,parser-type ,@initargs)) (setf (find-type-parser ',name) (make-instance ,parser-type ,@initargs))) ,parser)))
(defmacro defctype (name base-type &optional documentation) "Utility macro for simple C-like typedefs." (declare (ignore documentation)) (warn-if-kw-or-belongs-to-cl name) `(progn (eval-when (:compile-toplevel) (ensure-foreign-type ,name 'foreign-typedef)) (eval-when (:load-toplevel :execute) (let* ((btype (parse-type ',base-type)) (dtype (if (typep btype 'enhanced-foreign-type) 'enhanced-typedef 'foreign-typedef)) (parser (ensure-foreign-type ,name dtype))) (setf (name parser) ',name) (setf (actual-type parser) btype)))))
i'm back to darcs unpull for now.
hth,