Skip to content
Prev 539 / 696 Next

[R-sig-dyn-mod] Problem with loading compiled code into R

On Fri, Apr 7, 2017 at 10:08 PM, Tim Keitt <tkeitt at utexas.edu> wrote:

            
Let me clarify as I was alerted that that sounded harsh. (Not my intention.)

This error is often reported when linking code C++ compiled with gcc to
code compiled with clang. Those don't work well together. If your R was
compiled with gcc (clang), then you cannot use clang (gcc) to compile code
to link with R (even the g++-alike that comes with llvm).

The trick is to use "R CMD config" to find the compiler used to compile R.

In R (for the C++ compiler):
After that, "R CMD SHLIB --clean" should use the correct compiler and link
properly.

You can also try declaring your call point "extern C" to use the C linkage
ABI.

If you're using C rather than C++, then I'm not sure why it does not work
as the C linkage ABI is supposed to be standardized. You can try the above
with CC in place of CXX. Maybe that will fix it.

THK

http://www.keittlab.org/