[Rd] Object are not destroy while using error (Rf_error)
Antoine Lucas
@nto|ne|uc@@ @end|ng |rom gm@||@com
Sat Jan 21 16:55:33 CET 2023
Dear all,
I try to understand why on my computer I do not clear all data with this
code:
#include <R.h>
static int count = 0;
class A {
public:
A(){ printf("c %d\n", count);
count++; }
~A(){count--;
printf("d %d\n", count); }
};
extern "C" {
void testAL(){
A a;
{
A b;
}
error("does not write [d 0]");
}
}
To run with R: I build gcc -shared -I/opt/R-202301/lib/R/include/
myError.cpp -o myError.so
then in R: dyn.load("myError.so")
.C("testAL")
This writes c0, c1, d1 but not d0.
If I comment line "error", I does write latest d0.
How could I get all my objects destroy while sending en error message to R ?
Regards,
Antoine Lucas.
[[alternative HTML version deleted]]
More information about the R-devel
mailing list