Is it possible to reload an R package with native extensions in an R session?
I am developing Rliblinear, which uses several C
functions.
If I make a change to R code in the package, I can just reinstall and reload;
$ R CMD build Rliblinear
$ R CMD INSTALL Rliblinear
and then in an R
shell;
> detach("package:Rliblinear", unload=TRUE)
> library(Rliblinear)
However, the C
functions are not affected unless I restart the R
interpreter.
Is there a way I can force the interpreter to reload the shared object, Rliblinear.so
?
This will list your loaded dynamic link libraries:
library.dynam()
and this will unload Rliblinear.*
in the Rliblinear package.
library(Rliblinear)
# ... run package ...
detach("package:Rliblinear", unload = TRUE)
library.dynam.unload("Rliblinear", system.file(package = "Rliblinear"))
You can issue library.dynam()
again just to check that its no longer listed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With