Question

I'm using R 3.0.2 under Windows 7 (32bit) and has TDM-GCC-32 (gcc (tdm-2) 4.8.1) in the path.

When I try to use cppFunction, I get some error:

library(inline)
library(Rcpp)
src <- '
SEXP hellofun(){
 std::vector<std::string> s;
  s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
}'
hello_fun <- cppFunction(src)

Error message:

Error in inDL(x, as.logical(local), as.logical(now), ...) (from file1c8c8c929f5.cpp.R#1) : 
  unable to load shared object 'C:/Users/ssss11/AppData/Local/Temp/RtmpeywSmo/sourcecpp_1c8c47543253/sourceCpp_60750.dll':
  LoadLibrary failure:  Invalid access to memory location

However when I run example(cfuntion), it succeeds.

library(inline)
example(cfunction)

How to solve this problem?

Was it helpful?

Solution

I have no idea what TDM-GCC-32 (gcc (tdm-2) 4.8.1) may be -- but our documentation repeatedly stresses that one and only one compiler is support on Windows: the one that comes with the version of Rtools corresponding to your R version.

Now, 'TDM-gcc-32' may well be feature compatible, but if you want to use it you probably have to rebuild your entire R stack (ie R itself, all packages, ...) with it.

Sot it might be best to wait for R Core / CRAN to update Rtools to a version newer than gcc-4.6.*

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top