[Rd] Using .onUnload to unload DLLs

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jul 24 08:53:21 CEST 2012

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

More information about the R-devel mailing list