Re: [Rd] Using .onUnload() to unload compiled code

From: Seth Falcon <sfalcon_at_fhcrc.org>
Date: Wed 08 Feb 2006 - 18:13:01 GMT

Hi Jim,

On 8 Feb 2006, jmacdon@med.umich.edu wrote:
> If one wants to unload compiled code for a package containing a
> namespace, my understanding is that .onUnload() should be used, with
> a call to library.dynam.unload(). This is used in e.g., the stats
> and methods packages, but it appears to me that the compiled code is
> not being unloaded when the package is detached(). Am I
> misunderstanding something?

A package with a namespace can be loaded and not attached or loaded and attached.

Use loadedNamespaces() to see what is loaded, and search() to see what is attached.

.Last.lib() gets called by detach() is called. .onUnload() is called by unloadNamespace(). I'm pretty sure you can have both .Last.lib and .onUnload in a package with a namespace.

hth,

+ seth



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Feb 09 07:16:41 2006

This archive was generated by hypermail 2.1.8 : Fri 10 Feb 2006 - 02:15:50 GMT