Working in Windows, I’ve created an r package that links to a c++ dll as a shared library. This works fine and installs without problems on Windows. When I switch to linux, however, the so is not found.
Am I right in thinking that the only file in the src directory should be the .cpp file?
Do I actually need to run the SHLIB command in that directory before I create the package?
In the NAMESPACE I use:
useDynLib(myc.cpp,my.c.function)
and in the function call:
my.r.f <- .Call(my.c.function, a, b)
On windows running R CMD check works fine. Could it be my linux R configuration that is to blame? It seems to install 3rd party packages fine.
I’m stumped!
I think you should just use
useDynLib(myc)… The symbol lookup is done internally.EDIT: The other thing is the name of this object file — I think the standard makefile just names it with package name, so it should be rather
useDynLib(<package name>). At least it always works for me.