[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems in compilation



>I tried to compile the following five lines of code,
>
>(defconstant *test-rect* 
>  (make-record :rect :topleft #@(1 1) :bottomright #@(100 100)))
>
>(defun copy-something (from to)
>  (copy-bits from to *test-rect* *test-rect*))
>
>but the MCL system showed me:
>
>> Error: Can't dump #<A Mac Zone Pointer Size 8 #x3C1DA0> - unknown type
>> While executing: CCL::FASL-UNKNOWN
>> Type Command-. to abort.
>
>Does anyone know the problem?  Thanks.

You can't save objects allocated in the Mac heap (e.g. records)
in fasl files. Therefore, it's a bad idea to declare one of them
as a constant. Also, you need to use DEF-LOAD-POINTERS to
initialize such constants so that they will get newly allocated
in a saved application. Your code should read:

(defvar *test-rect*)

(def-load-pointers *test-rect* ()
  (setq *test-rect*
        (make-record :rect :topleft #@(1 1) :bottomright #@(100 100))))

(defun copy-something (from to)
  (copy-bits from to *test-rect* *test-rect*))