From pleydell at supagro.inra.fr  Wed Sep 23 14:06:50 2009
From: pleydell at supagro.inra.fr (pleydell at supagro.inra.fr)
Date: Wed, 23 Sep 2009 14:06:50 +0200
Subject: [Rd] Strange behaviour with global variable in C
In-Reply-To: <20090923134405.25tkm5ftwdw84sos@web.supagro.inra.fr>
References: <20090923134405.25tkm5ftwdw84sos@web.supagro.inra.fr>
Message-ID: <20090923140650.fsdazrjbcnc4g8ow@web.supagro.inra.fr>

To answer my own question...

I have two copies of my program

1) a working copy stored in $PROJECT/analysis/c
2) a packaged copy stored in $PROJECT/analysis/myPackage_1.0.2.tar.gz

I have been running a script which does the following

library(myPackage)
load(myData)
detach("package:myPackge")
dyn.load("$PROJECT/analysis/c/myProgram.so")
.C("main", ...)

The "resurrection" comes from values of loglik set in the packaged version and
not used in the working version. I had assumed detach would remove all traces
of the package but this is clearly wrong.

I wonder what over developers do when they want to switch from working with a
packaged version to a working version without restarting R and without
generating conflicts between the two?  (Perhaps I can find that in
documentation somewhere...)

David



[Rd] Strange behaviour with global variable in C
pleydell at supagro.inra.fr