Re: [R] Call to rgamma using .C causes R to hang

2010-07-20 Thread Steve Pederson
Hi Berwin, Thanks for the help. That got it working. And you're right. I'm still struggling my way through & trying to understand Section 5. http://cran.r-project.org/doc/manuals/R-exts.html#System-and-foreign-language-interfaces Cheers, Steve Berwin A Turlach wrote: G'day Steve, On Tue,

Re: [R] Call to rgamma using .C causes R to hang

2010-07-20 Thread Berwin A Turlach
G'day Steve, On Tue, 20 Jul 2010 17:20:49 +0930 Steve Pederson wrote: I suggest to insert the following two lines (untested as I usually don't work on Windows): > # include > # include > void test1 (double *x, double *result) > { GetRNGstate(); > result[0] = rgamma(*x, 2.0);

[R] Call to rgamma using .C causes R to hang

2010-07-20 Thread Steve Pederson
Hi, I've been trying to get this working for ages, but it causes R to hang. Here is my C code saved as test1.c # include # include void test1 (double *x, double *result) { result[0] = rgamma(*x, 2.0); } This was compiled using R CMD SHLIB test1.c & loaded in R using: dyn.load("test1.dll