Dear R-help list, for a package that uses Rmpi calls and a namespace, I need to define a .Last() function to call mpi.finalize() - directly before R quits. The hooks like on .onUnload are not useful in this case, because they are not executed when the R session is finished. The defined .Last() must be in the base namespace to be executed, is there a better way to do this than this hack : eval(expr=".Last" <- function() mpi.finalize(), envir .BaseNamespaceEnv) ? Thanks! Ralf.