[R] GetRNGstate() crashes in Windows

From: Ju-Sung Lee <jusung_at_andrew.cmu.edu>
Date: Tue 28 Jun 2005 - 15:07:48 EST


Hi,

Has anyone managed to successfully call GetRNGstate() / PutRNGstate() without crashing in a Windows environment (spec. XP)? I've compiled successfully using both the latest Cygwin, latest Mingw, and the version of Mingw suggested in "Building R for Windows" website, but when the executable runs, it crashes; the functions themselves can run when I omit GenRNGstate()/PutRNGstate, but return the same values every time. My compilation command is, having copied R.dll to my current directory:

gcc -o prog.exe prog.c -I{R's include path} R.dll

I've also tried:

gcc -o prog.exe prog.c -I{R's include path} -L./ -lR

I've managed to successfully compile Rmath.dll and call R functions that way, but remain puzzled why the first way doesn't work. I've read mention of "initializing" R (within a C program I assume) but haven't found the documentation that explains this.

My test program is simply:
#include <R.h>
int main() {

   GetRNGstate();
   PutRNGstate();
   return 0;
}

I've also tried #include-ing host of the other .h files. Thanks!

Juice



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 28 15:13:14 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:03 EST