[Rd] Strange behaviour with global variable in C

pleydell at supagro.inra.fr pleydell at supagro.inra.fr
Wed Sep 23 14:06:50 CEST 2009


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



More information about the R-devel mailing list