[R] dyn.unload? library.dyn.unload?

wolski wolski at molgen.mpg.de
Tue Dec 30 12:51:42 CET 2003


Hi!

The writing R extension states.
"The shared object/DLL is loaded by dyn.load and unloaded by dyn.unload. Unloading
is not normally necessary, but it is needed to allow the DLL to be re-built on some platforms,
including Windows."

I am working on Windows.
 
I load the dll as described in R-exts with 
.First.lib <- function(lib, pkg) library.dynam("mscalibD",pkg,lib)
in the zzz.R file.

After starting R and loading the package with
library(mscalibD)

>library.dynam()
[1] "ts"       "nls"      "modreg"   "mva"      "ctest"    "methods"  "mscalibD"

> dyn.unload("D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll")
Error in dyn.unload(x) : dynamic/shared library "D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll" was not loaded

But
> dyn.load("D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll")
> dyn.unload("D:/prog/R/rw1081/library/mscalibD/libs/mscalibD.dll")
works.

So i guess that dyn.unload isn't supposed to work together with library.dynam. Is this right?

I guess also that I should use instead
.Last.lib<-funciton(libpath) library.dynam.unload("mscalibD", libpath)

Is this right? If so where I have to place this function? In the zzz.R?

And how to call it from within R? Is it called by detach()?

> detach(package:mva)
> is.loaded(symbol.For("hcass2"))
[1] TRUE

I gues no. Because as dyn.load {base} example section states
is.loaded(symbol.For("hcass2")) #-> probably TRUE, as mva is loaded.


The help is mind boggling. Please help!

Eryk




More information about the R-help mailing list