Re: [Rd] on.exit called on loading ?

From: Henrik Bengtsson <hb_at_stat.berkeley.edu>
Date: Tue 16 Jan 2007 - 21:41:45 GMT

on.exit() applies to the function where it was called, i.e. closeSomeServices() is called when .onLoad() exits, or whatever function it is defined in. You're looking for .onUnload(). Make sure to read the help for details.

Cheers

Henrik

On 1/17/07, Dirk Eddelbuettel <edd@debian.org> wrote:
>
> I just found out that an .onLoad() function such as this stylized one (where
> I just renamed some identifiers)
>
>
> .onLoad <- function(lib, pkg) {
> require(zoo, quiet=TRUE, warn.conflicts=FALSE)
> library.dynam("foolib", pkg, lib )
> if (.Platform$OS.type != "windows") {
> initSomeServices()
> }
> if (.Platform$OS.type != "windows") {
> on.exit(closeSomeServices())
> }
> }
>
> actually triggers a call of 'closeSomeServices()'. I am probably
> misunderstanding something here -- but I thought on.exit() would only be
> called on, well, exit ?
>
> Dirk
>
> --
> Hell, there are no rules here - we're trying to accomplish something.
> -- Thomas A. Edison
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Jan 17 08:47:30 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 16 Jan 2007 - 22:31:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.