Load the specified file of compiled code if it has not been loaded already, or unloads it.
library.dynam(chname, package, lib.loc,
verbose = getOption("verbose"),
file.ext = .Platform$dynlib.ext, …)<p></p><p>library.dynam.unload(chname, libpath,
verbose = getOption("verbose"),
file.ext = .Platform$dynlib.ext)</p><p>.dynLibs(new)</p>
| Parameter | Description |
|---|---|
chname |
a character string naming a DLL (also known as a dynamic shared object or library) to load. |
package |
a character vector with the name of package. |
lib.loc |
a character vector describing the location of R library trees to search through. |
libpath |
the path to the loaded package whose DLL is to be unloaded. |
verbose |
a logical value indicating whether an announcement is printed on the console before loading the DLL. The default value is taken from the verbose entry in the system options. |
file.ext |
the extension (including . if used) to append to the file name to specify the library to be loaded. This defaults to the appropriate value for the operating system. |
… |
additional arguments needed by some libraries that are passed to the call to dyn.load to control how the library and its dependencies are loaded. |
new |
a list of "DLLInfo" objects corresponding to the DLLs loaded by packages. Can be missing. |
# NOT RUN {
## Which DLLs were dynamically loaded by packages?
library.dynam()
## More on library.dynam.unload() :
# }
# NOT RUN {
require(nlme)
nlme:::.onUnload # shows library.dynam.unload() call
detach("package:nlme") # by default, unload=FALSE , so,
tail(library.dynam(), 2)# nlme still there
## How to unload the DLL ?
## Best is to unload the namespace, unloadNamespace("nlme")
## If we need to do it separately which should be exceptional:
pd.file <- attr(packageDescription("nlme"), "file")
library.dynam.unload("nlme", libpath = sub("/Meta.*", '', pd.file))
tail(library.dynam(), 2)# 'nlme' is gone now
unloadNamespace("nlme") # now gives warning
# }