[R] How to unload a dll loaded via library.dynam()?

Alex F. Bokov ahupxot02 at sneakemail.com
Fri Feb 20 00:19:10 CET 2009


Hello. To save the hassle of quitting and restarting R every time I rebuild the package I'm working on (for the purposes of this question called "roots") I would like to write a script cleanly remove the package from my R session and then load it again. Of course detach("package:roots") works for the native R objects in the package. However, the compiled C library remains loaded. Using library.dynam.unload as documented results in:

Error in library.dynam.unload("roots.so", "~/R/x86_64-pc-linux-gnu-library/2.8/roots/libs/") :
  shared library 'roots' was not loaded

I also tried the above command with the file extension omitted and the last one and two levels of the directory path omitted. In both cases I still get the "not loaded" error. I've also Googled the list archives and while there were several questions like mine, none of them were answered by the list. Am I to believe that this is something hardly anybody does? Does this mean everybody sits around waiting for R to start up everytime they make a minor change to the C source?

If there is a tutorial for doing this, I'd much appreciate the link.

Thank you for your advice.




More information about the R-help mailing list