Skip to content
Prev 32694 / 63421 Next

Auto-upgrading a package under Windows ?

On Mon, 18 May 2009, Dirk Eddelbuettel wrote:

            
The commonly used test is .Platform$OS.type == "windows": that value 
is computed at installation so will be marginally faster.
It's not only Windows that has that problem, but it does at least 
report it.  Some Unixen used (at least) to let you replace a DSO which 
is in use, and then crash the process using the DSO.

That's an issue with automated updating of R packages in a centrally 
managed system, so we do it during 'at risk' periods when activity is 
expected to be low.
Can you not run a check of up-to-date-ness in the .onLoad hook for the 
package?  If you load the DLL in that hook, this can be run before the 
DLL is loaded.  This would need either each package only to update 
itself or the check to be in all packages that might get updated.

You could unload the loaded namespace, provided it has a .onUnload() 
action that calls library.dynam.unload(), re-install then re-load. 
However, we've seen instances where unloading and re-loading a DLL in 
a session did not work (crashes etc) for various reasons -- it does 
not for example re-load and hence re-initialize any dependendent DLLs.