[Rcpp-devel] RInside destructor not working properly?

Dirk Eddelbuettel edd at debian.org
Mon Aug 27 15:39:14 CEST 2012

On 27 August 2012 at 22:26, Darren Cook wrote:
| > I was not aware that two instances of R are active at the same time.
| > It was my expectation that by instantiating the RInside class as a
| > local variable, at the end of foo() the destructor R.~RInside() would
| > be called and the encapsulated R instance would be terminated, before
| > a new one is instantiated in bar().
| That does seem reasonable :-)

Sure. "In theory, theory and practice are the same. In practice they are not."

Fingers are pointing to the R end of things, rather than the RInside wrapping
of it.  If this can be improved, great.

| > I don't think that it is proper to modify main()
| > with the unit testing framework that I'm using (gtest), as the tests
| > are discovered without explicitly calling them from main().
| I assume there must be a "nothing we can do about" reason why RInside
| works the way it does. So I wonder if you can create a global RInside
| instance using a global test environment call?
| http://code.google.com/p/googletest/wiki/AdvancedGuide#Global_Set-Up_and_Tear-Down

One global instance is also what I do in the Qt embedding example.


Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  

More information about the Rcpp-devel mailing list