| Line 47... |
Line 47... |
| 47 |
|
47 |
|
| 48 |
If a namespace is unloaded (via \code{\link{unloadNamespace}}), a hook
|
48 |
If a namespace is unloaded (via \code{\link{unloadNamespace}}), a hook
|
| 49 |
function \code{.onUnload} is run (with a single argument) before final
|
49 |
function \code{.onUnload} is run (with a single argument) before final
|
| 50 |
unloading.
|
50 |
unloading.
|
| 51 |
|
51 |
|
| 52 |
Note that the code in \code{.onLoad} and \code{.onUnload} is run
|
52 |
Note that the code in \code{.onLoad} and \code{.onUnload} should not
|
| 53 |
without the package being on the search path, but (unless circumvented)
|
53 |
assume any package except the base package is on the search path.
|
| 54 |
lexical scope will make objects in the namespace and its imports
|
54 |
Objects in the current package will be visible (unless this is
|
| 55 |
visible. (Do not use the double colon operator in \code{.onLoad} as
|
55 |
circumvented), but objects from other packages should be imported or
|
| 56 |
exports have not been processed at the point it is run.)
|
56 |
the double colon operator should be used.
|
| 57 |
|
57 |
|
| 58 |
\code{.onLoad}, \code{.onUnload} and \code{.onAttach} are looked for
|
58 |
\code{.onLoad}, \code{.onUnload} and \code{.onAttach} are looked for
|
| 59 |
as internal objects in the namespace and should not be exported
|
59 |
as internal objects in the namespace and should not be exported
|
| 60 |
(whereas \code{.Last.lib} should be).
|
60 |
(whereas \code{.Last.lib} should be).
|
| 61 |
|
61 |
|
| 62 |
Anything needed for the functioning of the namespace should be
|
62 |
Anything needed for the functioning of the namespace should be
|