From dmurdoch at pair.com  Mon May  3 14:17:06 2004
From: dmurdoch at pair.com (Duncan Murdoch)
Date: Mon May  3 14:17:11 2004
Subject: [Rd] Finalization and external pointers
Message-ID: <l1dc90h92tr31qqj3h08c9jee7d9nff9jo@4ax.com>

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


[Rd] Finalization and external pointers
Duncan Murdoch