diff --git a/DESCRIPTION b/DESCRIPTION index 807b81c..9662af4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,4 +12,5 @@ Collate: Classes.R Methods.R Operators.R - pkgname.R \ No newline at end of file + pkgname.R + zzz.R \ No newline at end of file diff --git a/NAMESPACE b/NAMESPACE index 29abfa8..bede7ab 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,2 +1,4 @@ exportPattern("^[[:alpha:]]+") +export(".onLoad") +export(".onDetach") useDynLib(RElem) diff --git a/R/Environment.R b/R/Environment.R index 5ee8568..7db47ca 100644 --- a/R/Environment.R +++ b/R/Environment.R @@ -29,8 +29,6 @@ Initialize<-function(){ Finalize<-function(){ if( Initialized() ) .Call("finalize") - else - cat("Not initialized\n"); } WorldRank<-function(){ diff --git a/R/zzz.R b/R/zzz.R new file mode 100644 index 0000000..f11e7b2 --- /dev/null +++ b/R/zzz.R @@ -0,0 +1,8 @@ +.onLoad <- function(library = find.package("RElem"), package = "RElem"){ + Initialize() +} + +.onDetach <- function(library = find.package("RElem"), package = "RElem"){ + cat("MPI finalized") + Finalize() +}