[Rcpp-devel] Defining template specialisation for wrap on Windows 64bit (Compilation error: 'result_type' does not name a type)

Renaud Gaujoux renaud at mancala.cbio.uct.ac.za
Thu Oct 3 15:39:53 CEST 2013

> I understand that. But I fear you are bitten by a side-effect of linking
> against the full R on Windows, and linking against a much smaller subset may
> give you a better chance at success (conditional on my first hypothesis being
> correct, which may be unlikely ;-)

The error occurs on compilation not linking. It occurs when compiling
the RcppOctave library, which is made against full R since it is the
package's library and will be called from an R session. Can this one
be linked against libRmath? Besides, can Rcpp code be linked against

> | 2) not wanted: I link against the currently used R library because I
> | want to use exactly its RNG, with synchronised seed etc... libRmath
> | only provides one kind of RNG, which is not even the default RNG in
> | vanilla R (who knows why...) No ways of forcing a particular seed
> | (i.e. an RNG kind).
> I always confuse myself here but I thought you could get all distributions
> and all generators -- see help("RNGkind").

Last time I looked at RNG.c (or filename like that) in R source code,
you could not get anything else than Marsaglia.

> int main(void) {
>     set_seed(123, 456);
>     printf("rnorm: %f %f\n", rnorm(0.0, 1.0), rnorm(0.0, 1.0));
>     return 0;
> }
> edd at max:~/src/progs/C$ ./rmath_rnorm
> rnorm: -0.334377 -0.293497
> edd at max:~/src/progs/C$ ./rmath_rnorm
> rnorm: -0.334377 -0.293497
> edd at max:~/src/progs/C$
> The only thing left is figuring out how to go from R's single-arg set.seed()
> to this one.  I think I once looked into this when I connected R's RNGs to
> (R)Dieharder a few years back but I can't quite recall what the story was.

That's the thing, set.seed is the only exported function that can
touch the RNG and only enables to set the 2-length seed for Marsaglia,
and the kind cannot be changed, see (which also interestingly tells
you something about the order of evaluation of printf arguments...):

Rscript -e "RNGkind('Marsaglia'); .Random.seed[2:3] <- c(123L, 456L); rnorm(2)"
[1] -0.2934974 -0.3343770

> Yes, this needs a Windows expert.

Anybody around listening to us?


More information about the Rcpp-devel mailing list