On Jan 30, 2010, at 12:22 AM, Marco Maggi wrote:
I am skimming through Chicken's documentation to understand what it can do; is there a way to automatically apply a finalisation function when a pointer to a foreign object (C language structure) is garbage collected? Something like guardians.
You could use set-finalizer! on the pointer object or whatever scheme object contains the raw C pointer. Does that answer your question? There should be some examples in the eggs, for example objc.
$ chicken-doc set-finalizer\! path: (library set-finalizer!) procedure: (set-finalizer! X PROC) Registers a procedure of one argument `PROC`, that will be called as soon as the non-immediate data object `X` is about to be garbage-collected (with that object as its argument). Note that the finalizer will '''not''' be called while interrupts are disabled. This procedure returns `X`. _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users