Skip to content

Reset an embedded R.dll

6 messages · Bernd Schoeller, Brian Ripley

#
Dear List,

I am learning how to use the R.dll unter Windows to embed an R interpreter  
into another programming language.

What I would like to know, and I have not yet found an answer in the  
documentation: is there a way to 'reset' the interpreter to bring it to  
the state that it was directly after the call of the initialization  
routine?

Thanks for any hints,
   Bernd
#
On Wed, 14 May 2008, Bernd Schoeller wrote:

            
Call the exit and initialization routines.  That will not completely reset 
things (it will not unload package DLLs for example), but it is the 
nearest that is provided.
#
On Thu, 15 May 2008 07:15:15 +0200, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
Thank you very much, I think that will be sufficient.

Last question: Will I need to UNPROTECT_PTR all references held, or will  
the call to Rf_endEmbeddedR also free protected references?

Bernd
#
On Thu, 15 May 2008, Bernd Schoeller wrote:

            
What is a 'reference' here?

Rf_endEmbeddedR  does what ending an R session does, no more, no less.
#
On Thu, 15 May 2008 06:04:51 -0000, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:

            
Right, my question was imprecise. I meant 'SEXP' (which is a  
reference/pointer to a SEXPREC, as far as I understand it).
Ok - my question put differently: Will ending an R session run a full  
garbage collection, ignoring the 'protected' status of previously  
protected SEXP?

Bernd
#
On Thu, 15 May 2008, Bernd Schoeller wrote:

            
As distinct from the various reference SEXPREC types.
No.  It will run finalizers if they were set up to do so.