In my previous post about writing an R extension, I the reason why I chose to use C instead of C++ was because I couldn’t find a way to tell R tools that they should use the C++ compiler, g++, and not the C compiler, gcc. Well, it turned out that the solution was trivial: you just need to change the extension: for C, the extension is .c
; for C++, the extension can be .cc
, .cpp
or .C
. I had actually already tried .cpp
with no success, so probably did something else wrong at that time…
It is to be noted, however, that .Call doesn’t seem too happy about this modification, and for the moment I haven’t been able to fix that new error in the hello world package C++ version:
Error in .Call(“helloWorldC”, n = n, m = m, PACKAGE = “helloworld”) :
C symbol name “helloWorldC” not in DLL for package “helloworld”
Did you ever find a solution to this problem? I’m in the same mess and can’t figure why.
Nope, I got tired of this
poornon-existent documentation and ended up implementing the C++ part as a stand-alone application. Worked just as fine for what I was doing (very few calls to that application in a run). I know, that’s cheating but I had some deadlines coming 😉I’d be much interested to know if you eventually find a fix!