One problem that comes up for us quite a bit when using R.NET from the RProvider is that we need to load it into multiple appdomains simultaneously. The native R.DLL is obviously AppDomain agnostic, but the R.NET instances are completely isolated.
The concrete problem is that in the second appdomain, the R.DLL fails during initialization because it is already initialized.
Any ideas on how we could make that work? Seems like R.DLL instances would have to be managed through some native code, or we would need some process-wide flag to record the fact that R.DLL has already been initialized.
Basically this is the same issue as the multiple-initialization problem.
Comments: I see what you mean by there being nothing obvious in R native to fish out for information whether it was initialized already or not. It seems that any of the variables that could be useful indicators are not accessible, directly or indirectly from the API indeed. Maybe using an environment variable is all we can do. I'll have limited time for R.NET till this weel-end but will keep you posted.
The concrete problem is that in the second appdomain, the R.DLL fails during initialization because it is already initialized.
Any ideas on how we could make that work? Seems like R.DLL instances would have to be managed through some native code, or we would need some process-wide flag to record the fact that R.DLL has already been initialized.
Basically this is the same issue as the multiple-initialization problem.
Comments: I see what you mean by there being nothing obvious in R native to fish out for information whether it was initialized already or not. It seems that any of the variables that could be useful indicators are not accessible, directly or indirectly from the API indeed. Maybe using an environment variable is all we can do. I'll have limited time for R.NET till this weel-end but will keep you posted.