2
간단한 실험은 한 번에 스레드 당 하나의 RInside 인스턴스 만 허용된다는 것을 보여줍니다.RInside 소멸자 사용
#include <RInside.h>
int main() {
RInside R1;
R1.parseEval("cat('Hello, R1\n')");
RInside R2;
R2.parseEval("cat('Hello, R2\n')");
return 0;
}
이 프로그램은 다음과 같은 출력과 충돌 :
Hello, R1
terminate called after throwing an instance of 'std::runtime_error'
what(): can only have one RInside instance
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
succesive RInside 인스턴스 생성과 다른 실험의 결과가 매우 분명하지 않다 그러나.
#include <RInside.h>
int main() {
RInside *R1 = new RInside();
R1->parseEval("cat('Hello, R1\n')");
delete R1;
RInside *R2 = new RInside();
R2->parseEval("cat('Hello, R2\n')");
delete R2;
return 0;
}
이 프로그램은 R2 생성 순간에 윙윙 거립니다.
Hello, R1
Lost warning messages
적절한 RInside 정리하기에 충분 R1 소멸자 호출이 없습니다 : 이전의 출력은 다음과 같습니다?