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 <R.h>
# include <Rmath.h>
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")
out <- .C("test1",x=as.double(2),random=double(1))

R then hangs

However, if I change "rgamma" in the above to be "rnorm" or "runif", everything works just fine. I'm not sure if it matters, but the function 'rgamma' under R works OK.

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.


Thanks,

Steve

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to