I have a C++ shared library that I’d like to use in a R package. I have tried to find a example on how to do that but couldn’t manage. Could someone help me with a reproducible example or a link where I could find a tutorial ?
Hello sorry but I do not see anything mentioning shared library in there am I missing something ?
Note sure - was thinking you could wrap your C++ functions this way? Admittedly, this is the extent of my current knowledge on the subject, so here is hoping that someone else can chime in to help.
Are you referring to a library installed in the OS or do you want to include the library with the package? Which OS(s) do you target? Is the librrary header only or compiled?
Some select examples:
- RcppGSL links to a system installed GSL
- nloptr links to a system installed nlopt or downloads and compiles the library
- rzmq links to a system installed ZMQ
- RcppArmadillo and RcppEigen ship header only libraries that are used by many other packages
As I understand what you are trying to do, source C/++ inside an R-package, you must follow these standard steps R Packages: Compiled code
This will generate properly built packages which conform to a standardized structure which allows your R functions to act as thin wrappers for C/++ code.