<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:NimbusSanL-Regu;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Here is my beginner’s question:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoPlainText>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.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>(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?<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>(ii) From the convolution example (see slide #43/112 from
Dirk’s recent talk “Seamless R Extensions<o:p></o:p></p>
<p class=MsoPlainText>using Rcpp and RInside” at <span style='font-family:
NimbusSanL-Regu'>UCLA</span> 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?<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>(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?<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Thanks<o:p></o:p></p>
<p class=MsoPlainText>Johnny<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>