[Rd] Finalization and external pointers

Duncan Murdoch dmurdoch at pair.com
Mon May 3 14:17:06 CEST 2004

I'm adding things to the Windows RGui so that there's more control of
the interface from within R.

One thing I'm considering is giving access to the Graphapp window
objects using external pointers.  This raises the issue of
finalization on both sides:

 - If someone creates a pointer referring to a window, then that
pointer should be changed to NULL when the window is closed.

 - If garbage collection destroys a pointer referring to a window,
then the window should know not to change that pointer to NULL later.

Are there other examples like this I can look at?  I'd like to follow
existing conventions rather than invent my own.

And a related question:  is there a writeup anywhere on the
R_RegisterFinalizerEx function?  What does the onexit argument do?

Duncan Murdoch

More information about the R-devel mailing list