From sfalcon at fhcrc.org  Wed Feb  8 19:13:01 2006
From: sfalcon at fhcrc.org (Seth Falcon)
Date: Wed, 08 Feb 2006 10:13:01 -0800
Subject: [Rd] Using .onUnload() to unload compiled code
In-Reply-To: <s3e9d80e.049@med-gwia-02a.med.umich.edu> (James MacDonald's
	message of "Wed, 08 Feb 2006 11:37:38 -0500")
References: <s3e9d80e.049@med-gwia-02a.med.umich.edu>
Message-ID: <m2slqtbtxu.fsf@ziti.local>

Hi Jim,

On  8 Feb 2006, jmacdon at 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



[Rd] Using .onUnload() to unload compiled code
Seth Falcon