[R] GetRNGstate() crashes in Windows

Ju-Sung Lee jusung at andrew.cmu.edu
Tue Jun 28 07:38:15 CEST 2005


I think I've misread the intent of the GetRNGstate() and other API 
functions; these only work when embedded in C functions eventually called 
from R.  Apologies for the mistake.

On Tue, 28 Jun 2005, Ju-Sung Lee wrote:

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




More information about the R-help mailing list