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

Questions to Bill's response



Regarding Bill's response to my problem in compilation, I wonder
whether it is necessary to use DEF-LOAD-POINTERS if I use DEFVAR
or DEFPARAMETER to define a variable with the type MACPTR 
(e.g., records).  What is the difference between a DEFVAR with
DEF-LOAD-POINTERS and a DEFVAR without DEF-LOAD-POINTERS?  Does
the former define a constant?  Thanks.

-jipan@gmuvax2.gmu.edu

>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*))