Skip to content
Prev 2167 / 10988 Next

[Rcpp-devel] Question on 5.6 Interfacing C++ code

Hi, thanks!
ok, so where in the package would I put the system call in the package to
have it run when installing the package?
I'm trying to figure out how take commands such as " R CMD SHLIB X.cc
X_main.cc" followed by "dyn.load(paste("X", .Platform$dynlib.ext, sep =
""))," which are commands I can get to work for myself as a human
interactively, and put the commands into a package to be automatically run
when installing the package. I mean, it's great if I can compile a c++ file
and then use it inside R, but I'm only doing that so I can let other people
do that via a package. As much as I read this documentation, I keep missing
the connections between the different sections. This is a section I am
loving because it works very well. Thus, I want to figure out how to take
the baby steps I'm doing and combine them into a package. Specifically, I
want to take these two commands and insert them into a package so that these
commands will compile my code and make a dynamic ".so" file where R can
access its functions when others install my package.
Ah, thanks, that clarifies exactly what .Platform$dynlib.ext is, it's ".so"
on my system. 

This, the dyn.load(paste("X", .Platform$dynlib.ext, sep = "")) is equivalent
to the command dyn.load("X.so) which now makes sense in that context!