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]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to