From ripley at stats.ox.ac.uk  Tue Jul 24 08:53:21 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 24 Jul 2012 07:53:21 +0100
Subject: [Rd] Using .onUnload to unload DLLs
In-Reply-To: <CAFOpNVGEO87Eng2zQtMmaqino+u1oj1wp98C4DEDtSDi6-JMzQ@mail.gmail.com>
References: <CAFOpNVGEO87Eng2zQtMmaqino+u1oj1wp98C4DEDtSDi6-JMzQ@mail.gmail.com>
Message-ID: <500E4661.7030807@stats.ox.ac.uk>

On 24/07/2012 07:11, Winston Chang wrote:
> I've noticed that many of the "base" R packages have an .onUnload()
> function which automatically unloads compiled shared libraries
> with library.dynam.unload(). For example:
>
>> stats:::.onUnload
> function (libpath)
> library.dynam.unload("stats", libpath)
> <bytecode: 0x1033b9c30>
> <environment: namespace:stats>
>
>
> I've noticed that many other packages don't do this. Is it considered good
> practice to do this in packages that have compiled code?

Yes, but do not all packages have well-enough written DSOs to do this. 
(Tcl/Tk does not, so we no longer attempt to upload tcltk.dll.)

>
> -Winston
>
> 	[[alternative HTML version deleted]]

which the posting guide expressly asked you not to do.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Using .onUnload to unload DLLs
Prof Brian Ripley