[plt-scheme] equivalent to atexit?

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Tue Mar 24 03:24:40 EDT 2009

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



Posted on the users mailing list.