From fox_fzseud at trashmail.net  Sat Aug 30 14:30:06 2008
From: fox_fzseud at trashmail.net (fox_fzseud at trashmail.net)
Date: Sat, 30 Aug 2008 14:30:06 +0200 (CEST)
Subject: [Rd] R embedded reinitialization error (PR#12644)
Message-ID: <20080830123006.927F2282EFC2@mail.pubhealth.ku.dk>

Full_Name: R Embedder
Version: 2.7.2 
OS: win XP SP 2
Submission from: (NULL) (83.25.35.249)


I'm having problems using embedded R. I try to adapt examples from
"tests/Embedding/".
Everything works fine except when I try to reinitialize R for the second time
in the same program. I need to reinitialize correctly because my code
is some kind of .dll plugin to an external application.
 
The simplest example I can provide is a modified tests/Embedding/Rplot.c file
with one line added.
Here each call to "eval_R_command" contains complete
initialization/deinitialization
of embedded R. Second call to eval_R_command fails:


//tests/Embedding/Rplot.c

#include "embeddedRCall.h"
int main(int argc, char *argv[]) {
    eval_R_command("plot", argc, argv); // this completes OK
    eval_R_command("plot", argc, argv); // this line is added and fails
    return(0);
} 

Output:
D:\R\tests\Embedding>rplot
Error in .Call("R_isMethodsDispatchOn", onOff, PACKAGE = "base") :
  Incorrect number of arguments (2), expecting 1 for R_isMethodsDispatchOn
Error: could not find function "plot"


Increasing stack size to 10 MB did not help.
I use latest Rtools gcc toolchain.



[Rd] R embedded reinitialization error (PR#12644)
fox_fzseud at trashmail.net