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

Steve Pederson stephen.pederson at adelaide.edu.au
Tue Jul 20 10:46:50 CEST 2010


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, 20 Jul 2010 17:20:49 +0930
> Steve Pederson <stephen.pederson at adelaide.edu.au> wrote:
> 
> I suggest to insert the following two lines (untested as I usually
> don't work on Windows):
>  
>> # include <R.h>
>> # include <Rmath.h>
>> void test1 (double *x, double *result)
>> {
> 	GetRNGstate();
>>      result[0] = rgamma(*x, 2.0);
> 	PutRNGstate();
>> }
>>
> 
> [...] 
>> I'm running Windows XP & I followed the instructions at
>> http://cran.r-project.org/doc/manuals/R-admin.html#Windows-standalone
>> after building R from source.
> 
> But you didn't follow the instructions of Section 6.3 in the "Writing R
> Extensions manual. :)
> 
> http://cran.r-project.org/doc/manuals/R-exts.html#Random-numbers
> 
> HTH.
> 
> Cheers,
> 
> 	Berwin
> 
> ========================== Full address ============================
> Berwin A Turlach                      Tel.: +61 (8) 6488 3338 (secr)
> School of Maths and Stats (M019)            +61 (8) 6488 3383 (self)
> The University of Western Australia   FAX : +61 (8) 6488 1028
> 35 Stirling Highway                   
> Crawley WA 6009                e-mail: berwin at maths.uwa.edu.au
> Australia                        http://www.maths.uwa.edu.au/~berwin
>



More information about the R-help mailing list