Rev 25260 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{ns-lowlev}\title{Low Level Name Space Support Functions}\alias{attachNamespace}\alias{loadNamespace}\alias{loadedNamespaces}\alias{unloadNamespace}\alias{.onLoad}\alias{.onUnload}\alias{.onAttach}\alias{loadingNamespaceInfo}\alias{saveNamespaceImage}\usage{attachNamespace(ns, pos = 2)loadNamespace(package, lib.loc = NULL,keep.source = getOption("keep.source.pkgs"),partial = FALSE, declarativeOnly = FALSE)loadedNamespaces()unloadNamespace(ns)loadingNamespaceInfo()saveNamespaceImage(package, rdafile, lib.loc = NULL,keep.source = getOption("keep.source.pkgs"))}\arguments{\item{ns}{string or namespace object.}\item{pos}{integer specifying position to attach.}\item{package}{string naming the package/name space to load.}\item{lib.loc}{character vector specifying library search path.}\item{keep.source}{logical specifying whether to retain source.}\item{partial}{logical; if true, stop just after laoding code.}\item{declarativeOnly}{logical; disables \code{.Import}, etc, if true.}}\description{Low level name space support functions.}\details{The functions \code{loadNamespace} and \code{attachNamespace} areusually called implicitly when \code{library} is used to load a namespace and any imports needed. However it may be useful to callthese functions directly at times.\code{loadNamespace} loads the specified name space and registers it inan internal data base. A request to load a name space that is alreadyloaded has no effect. The arguments have the same meaning as thecorresponding arguments to \code{library}. After loading,\code{loadNamespace} looks for a hook function named \code{.onLoad} asan internal variable in the name space (it should not be exported).This function is called with the same arguments as\code{.First.lib}. Partial loading is used so support installation withthe \option{--save} option.\code{loadNamespace} does not attach the name space it loads to thesearch path. \code{attachNamespace} can be used to attach a framecontaining the exported values of a name space to the search path.The hook function \code{.onAttach} is run after the name spaceexports are attached, but this is not likely to be useful. Sharedlibrary loading and setting of options should be handled at loadtime by the \code{.onLoad} hook.\code{loadedNamespaces} returns a character vector of the names ofthe loaded name spaces.\code{unloadNamespace} can be used to forcea name space to be unloaded. An error is signaled if the name spaceis imported by other loaded name spaces. If defined, a hookfunction \code{.onUnload}, analogous to \code{.Last.lib}, is runbefore removing the name space from the internal registry.\code{unloadNamespace} will first \code{\link{detach}} a package ofthe same name if one is on the path, thereby running a\code{.Last.lib} function in the package if one is exported.\code{loadingNamespaceInfo} returns a list of the arguments thatwould be passed to \code{.onLoad} when a name space is being loaded.An error is signaled of a name space is not currently being loaded.\code{saveNamespaceImage} is used to save name space images forpackages installed with \option{--save}.}\keyword{internal}\author{Luke Tierney}