Here is the C code:
// a.cpp
void double_me(int* x) {
// takes a numeric input and doubles it
*x = *x + *x;
}
I compile the code with
>R CMD SHLIB a.cpp
After that i run R and type following commands:
dinfo <- dyn.load("a.so")
.C("double_me",x=2)
This end with error: "double_me" is not on the list.
Now the question: dyn.load works fine, dinfo contains:
DLL name: a Filename: /Users/myusername/a.so Dynamic lookup: TRUE
But the function is not on the table:
is.loaded("double_me") [1] FALSE
How could it happen? This happens on macOS.