[Openmcl-devel] Is it possible to call a function automatically when exit ccl?

R. Matthew Emerson rme at clozure.com
Tue Oct 18 05:13:30 UTC 2016


> On Oct 17, 2016, at 10:00 PM, Ice Rove <icerove at gmail.com> wrote:
> 
> Is it possible to call a function automatically when exit ccl? Both calling (quit) or kill the process in shell. Just like sbcl's *exit-hook*

Yes.  Push your 0-argument function onto ccl:*lisp-cleanup-functions*.  Note that doing save-application quits the lisp, so any functions on this list will be called before saving a heap image.

? (push #'(lambda () (print "I'm dying!")) *lisp-cleanup-functions*)
(#<Anonymous Function #x3020004B3ADF>)
? (quit)

"I'm dying!" 

A few more variables of this nature are briefly documented at http://ccl.clozure.com/docs/ccl.html#saving-applications



More information about the Openmcl-devel mailing list