Unloading rClr's AppDomain

Jun 19, 2015 at 3:23 PM
Hi,

Been using rClr very happily. Thanks again.

Is there any way to unload the AppDomain hosted by rClr without quitting R? It would make writing wrapper classes much easier if I didn't have to quit R every time something was changed. There is a function called clrShutdown() but when called it gives an error:

Error in .C("rclr_shutdown_clr", PACKAGE = nativePkgName) :
"rclr_shutdown_clr" not available for .C() for package "rClrMs"

which suggests it only works on mono?
Jul 4, 2015 at 1:41 AM
Hi,

Short answer is: no.

Longer answer:

rClr loads assemblies in a single appdomain. This was a conscious choice I made early for two reasons. One is that very, very counter-intuitive (though admitedly entirely logical) stuff happens with type checking across appdomains. Second is to limit risks of dangling pointers of R external pointers to CLR objects.

In effect clrShutdown is not practically useful, and I maybe should not even have added it. There is no way to make sure the CLR can be closed safely without dangling pointers from R, so implicitly rClr use cases are such that the CLR is only shut down with the end of the R session. Besides, as I recall it is not possibly to reinitialize an embedded CLR twice in the same process.

Apologies for the delay in replying.

Cheers