A standalone program linked against libRmath (the R stats functions compiled
into their own library) works:

#define MATHLIB_STANDALONE 1
#include <Rmath.h>

int
main(int argc, char** argv)
{
    int i;
    set_seed(123, 456);
    for (i=0; i<10; i++) {
        printf(" %d rgamma(1,1) %f\n", i, rgamma(1,1));
    }
    return 0;
}

e...@max:~$ gcc -o /tmp/colin /tmp/colin.c -lRmath -lm
e...@max:~$ /tmp/colin 
 0 rgamma(1,1) 0.314001
 1 rgamma(1,1) 1.498724
 2 rgamma(1,1) 0.154940
 3 rgamma(1,1) 0.053388
 4 rgamma(1,1) 0.404130
 5 rgamma(1,1) 0.167460
 6 rgamma(1,1) 0.260743
 7 rgamma(1,1) 3.204146
 8 rgamma(1,1) 0.271189
 9 rgamma(1,1) 1.129695
e...@max:~$ 

So the ball in our court.  Rcpp must be defining something that upsets the
inner loops in rgamma.

Dirk

-- 
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to