[Rcpp-devel] Rcpp

Jean-Eudes Dazard jxd101 at case.edu
Mon May 10 20:09:02 CEST 2010

Here is my beginner's question:


We want to interface an existing C++ subroutine to R. The subroutine can be
wrapped up in a C++ program, compiled with standard gcc, and run e.g. under
GNU/Linux 2.6.18-128.1.14.el5. It accepts several arguments to it.


(i) Using the .Call interface (with SEXP types) seems the best option since
we want to pass matrices, vectors, scalars to it from R. However, the
existing C++ subroutine is ~ hundreds of line long. To use Rcpp, it seems
unavoidable (yet purpose-defeating) to have to make a lot of changes at the
lower C++ level to be able to pass and handle these SEXP types. Is this
correct or is there something we missed?


(ii) From the convolution example (see slide #43/112 from Dirk's recent talk
"Seamless R Extensions

using Rcpp and RInside" at UCLA on March 30th), it is necessary to replace
the std::vector in C++ to an object of type RcppVector<double>. Do other
containers in C++ (set, list, map etc.) present in the original C++ code
need to be replaced whenever they appear in the code, or is it just the
containers which appear as arguments in the function call?


(iii) When including Rcpp.h and building a shared object, can problems arise
if the version of the gcc compiler used to build the shared object is
different from the gcc compiler version that was used to generate the binary
for R from the source code?






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100510/29d4aae9/attachment.htm>

More information about the Rcpp-devel mailing list