library.dynam
Loading DLLs from Packages
Description
Dynamically load or unload DLLs from packages.
Usage
library.dynam(chname, package = NULL, lib.loc = NULL,
verbose = getOption("verbose"),
file.ext = .Platform$dynlib.ext, ...)
library.dynam.unload(chname, libpath, verbose = getOption("verbose"),
file.ext = .Platform$dynlib.ext)
.dynLibs(new)
Arguments
chname |
a character string specifying the DLL name to load or unload.
|
package |
a character vector giving the name of packages.
|
lib.loc |
a character vector containing the names of library directories to search.
|
verbose |
a logical value. If TRUE, warning messages are displayed in some cases.
The default value is the value of option "verbose".
|
file.ext |
a character string giving the file extension (including the "."
character). The default is platform dependent: ".dll" for Windows,
and ".so" or ".sl" for UNIX platforms.
|
... |
other optional arguments pass to dyn.load().
|
libpath |
the library path for the DLL to unload.
|
new |
a list of "DLLInfo" objects, with class "DLLInfoList".
|
Details
- library.dynam is used to load a DLL dynamically by calling dyn.load.
The full file name of the DLL is created by combining the DLL path, chname
and file.ext. If the DLL does not exist, the function stops with an error message.
If the specified DLL is already loaded, a warning message is displayed when
verbose is TRUE, and returns the already-loaded "DLLInfo" object invisibly.
- library.dynam.unload is used to dynamically unload a DLL by calling
dyn.unload and remove the DLL info from the internal list.
The full file name of the DLL is created by combining libpath, chname
and file.ext. If the specified DLL is not loaded the function stops with an error message.
- .dynLibs is equivalent to getLoadedDLLs, except the DLLInfoList
structure it returns carries no names. The new parameter is ingored.
Value
library.dynam | If chname is missing or an empty string, returns
a list object with class "DLLInfoList" and each element is a "DLLInfo" object.
Otherwise, returns the loaded "DLLInfo" object invisibly. |
library.dynam.unload | returns the unloaded "DLLInfo" object invisibly. |
.dynLibs | returns nothing if new is specified. Otherwise, returns
a list object with class "DLLInfoList" and each element is a "DLLInfo" object. |
Differences between Spotfire Enterprise Runtime for R and Open-source R
In open-source R, .dynLibs is used to set the internal list of "DLLInfo" objects,
which is an object with class "DLLInfoList", if new is specified.
Otherwise, it just returns this internal list if new is missing.
In Spotfire Enterprise Runtime for R, .dynLibs is equivalent to getLoadedDLLs, except the DLLInfoList
structure it returns carries no names. The new parameter is ingored.
Note
Use library.dynam.unload instead of dyn.unload to unload the
DLLs that have been loaded through library.dynam.
References
Becker, R. A., Chambers, J. M., and Wilks, A. R. 1988. The New S Language. Pacific Grove, CA: Wadsworth & Brooks/Cole Advanced Books and Software.
See Also
Examples
identical(library.dynam(), .dynLibs()) # TRUE
library.dynam("stats", verbose = TRUE)
library.dynam("FOO", package = "FOO") # Error
library.dynam("MASS", package = "MASS", verbose = TRUE)
## Not run:
# This example only runs in R.
library.dynam.unload("MASS", file.path(Sys.getenv("R_HOME"),
"library/MASS"), verbose = TRUE)
## End(Not run)