[plt-scheme] equivalent to atexit?

From: YC (yinso.chen at gmail.com)
Date: Tue Mar 24 13:09:00 EDT 2009

Thanks Chongkai - i'll look into the approach below more.

On Tue, Mar 24, 2009 at 12:24 AM, Chongkai Zhu <czhu at cs.utah.edu> wrote:

> #lang scheme
> (require scheme/foreign)
>
> (define your-object 'x)
> (define release display)
>
> (define custodian (make-custodian))
>
> (unsafe!)
> ((get-ffi-obj "scheme_add_managed" #f
>             (_fun _scheme _scheme (_fun _scheme _pointer -> _void) _pointer
> _int
>                   -> _pointer))
> custodian
> your-object
> (lambda (your-object _) (release your-object))
> #f
> 1)
>
> (custodian-shutdown-all custodian)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090324/21e81985/attachment.html>

Posted on the users mailing list.