Description
I'm experiencing .Call issues when running functions built with Rcpp on Windows, if my c++ code uses C++11 std::regex
and I have found no way out so far.
Issues only arise after packaging, not using Rcpp::source("test.cpp")
.Call issues arise as soon as a regex is declared in the C++ code. Using it or no (as in std::regex_match) makes no change.
Unlike prior questions on similar issues, I have had neither building nor linking issues. Rcpp packages build and link fine using the C++11 plugin, making usable packages on my platform. C++11-specific constexpr
declarations and functions like std::stoi
cause no issue when std::regex
is not used.
The same packages build, install and run fine under linux, using vanilla std::regex.
Windows platform is :
R version 3.2.3 (2015-12-10)
x86_64-w64-mingw32/x64 (64-bit)
Running under:
Windows >= 8 x64 (build 9200)
Rcpp_0.12.3
Rtools 3.3.0.1959 running g++ 4.9.3 (x86_64-posix-seh,
built by MinGW-W64 project), normally C++11-compatible.
PKG_CXXFLAGS="-std=c++11"
Attached is a code chunk for testing.
This code runs OK when built using -DNO_REG. Otherwise invoking test::my_test(1, "1000")
returns:
`Error in .Call("test_my_test", PACKAGE = "test", prop, index) :
"test_my_test" not available for .Call() for package "test"`
Packaging code:
R console:
Rcpp::Rcpp.package.skeleton("test", attributes=TRUE, example_code=FALSE, cpp_files="test.cpp")
Rcpp::compileAttributes("test")
CMD console:
REM paths to R/bin/x64 and Rtools/bin, Rtools/mingw_64/bin added to PATH
set PKG_CXXFLAGS=-std=c++11
R CMD build test
R CMD INSTALL test_1.0.tar.gz