[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quickie: allocating a temporary handle
- To: info-mcl@digitool.com, mcdougal@cs.uchicago.edu
- Subject: Re: quickie: allocating a temporary handle
- From: jbk@world.std.com (Jeffrey B Kane)
- Date: Tue, 3 Jan 1995 22:19:24 -0500
- Sender: owner-info-mcl@digitool.com
I understand what you want to do, and why you would expect it to work,
but a quick look at the results of:
(macroexpand-1 '(rlet ((h (:TPrint :storage :handle)))
(unwind-protect
(progn (#_prOpen)
(#_prJobDialog h))
(#_prClose))))
shows:
(LET* ((H (CCL::%NEW-PTR 4 NIL))) ; <== Notice this
(DECLARE (DYNAMIC-EXTENT H))
(DECLARE (TYPE MACPTR H))
(DECLARE (CCL::UNSETTABLE H))
(UNWIND-PROTECT
(PROGN (TRAPS:_PROPEN)
(TRAPS:_PRJOBDIALOG H))
(TRAPS:_PRCLOSE)))
All you are alocating on the stack is a 4 byte pointer to the structure.
What you want to do is something like:
(let ((H (make-record (:TPrint))))
(DECLARE (TYPE MACPTR H))
(UNWIND-PROTECT
(PROGN (#_PROPEN)
(#_PRJOBDIALOG H))
(#_PRCLOSE)
(dispose-record h)))
Hope this helps
Jeffrey
======================================
Jeffrey Kane, MD
Kane Biomedical Systems
Boston, MA
Internet jbk@world.std.com
Compuserve 74206,640
AppleLink D0738
[Don't take life too seriously... it's not like anyone gets out of it alive.]