library.dynam {base} | R Documentation |
Load the specified file of compiled code if it has not been loaded already, or unloads it.
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)
chname |
a character string naming a shared library to load. |
package |
a character vector with the names of packages to search
through, or NULL . By default, all packages in the search
path are used. |
lib.loc |
a character vector describing the location of R
library trees to search through, or NULL . The default value
of NULL corresponds to all libraries currently known. |
libpath |
the path to the loaded package whose shared library is to be unloaded. |
verbose |
a logical value indicating whether an announcement is printed on the console before loading the shared library. The default value is taken from the verbose entry in the system options. |
file.ext |
the extension 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 is loaded. |
new |
a character vector of packages which have loaded shared libraries. |
library.dynam
is designed to be used inside a package rather
than at the command line, and should really only be used inside
.First.lib
on .onLoad
. The
system-specific extension for shared libraries
(e.g., ‘.so’ or ‘.sl’ on Unix systems)
should not be added.
library.dynam.unload
is designed for use in .Last.lib
or
.onUnload
.
.dynLibs
is used for getting or setting the packages that have
loaded shared libraries (using library.dynam
). Versions of R
prior to 1.6.0 used an internal global variable .Dyn.libs
for
storing this information: this variable is now defunct.
If chname
is not specified, library.dynam
returns a
character vector with the names of packages which have used it in the
current R session to load shared libraries. This vector is returned
as invisible
, unless the chname
argument is
missing.
If chname
is specifed, the return value is an object
of class DLLInfo
that identifies the DLL and can be used
in future calls. For packages that have namespaces, a list
of these objects is stored in the namespace's environment for
use at run-time.
library.dynam.unload
returns the updated character vector, invisibly.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
.First.lib
, library
,
dyn.load
, .packages
,
.libPaths
SHLIB
for how to create suitable shared libraries.
library.dynam() # which packages have been "dynamically loaded"