<div dir="ltr">OK, actually there is a simple way to achieve this, with minimal modifications to the Rcpp codebase:<div><a href="https://github.com/gaborcsardi/Rcpp/commit/8b160547d50d668099dff3802c01001baaf415b6" target="_blank">https://github.com/gaborcsardi/Rcpp/commit/8b160547d50d668099dff3802c01001baaf415b6</a><br>

</div><div><br></div><div>With this, I can put the functions I want to wrap to a separate file, that is essentially a header file, with contents like this:</div><div><br></div><div><div>#include <Rcpp.h></div><div>
using namespace Rcpp;</div>
<div><br></div><div>// [[Rcpp::export]]</div><div>List rcpp_hello_world();</div></div><div><br></div><div>The other reason why this is great is that I can now define potentially different conversions to arguments of the same C/C++ type. E.g. if I have (hypothetical) functions like this </div>

<div><br></div><div>double mean(MyNumericVector* vector);</div><div>void permute(MyNumericVector *vector);</div><div><br></div><div>then I can write the different as<> conversion for the first vector, where I don't actually need to copy the SEXP, by simply putting this in the header file that defines the wrapping:</div>

<div><br></div><div>double mean(in_MyNumericVector *vector);</div><div>void permute(inout_MyNumericVector *vector);</div><div><br></div><div>and then defining conversions for in_MyNumericVector and inout_MyNumericVector.</div>

<div><br></div><div>All good. Best,</div><div>Gabor</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 12, 2014 at 12:05 PM, Gábor Csárdi <span dir="ltr"><<a href="mailto:csardi.gabor@gmail.com" target="_blank">csardi.gabor@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 12, 2014 at 11:41 AM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:</div>

<div class="gmail_quote">[...]<div class=""><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>| My question is, is there a way you keep the original sources of the wrapped<br>

</div><div>
| library intact? I would be updating the sources regularly, and I figured the<br>
| best would be not to touch them at all.<br>
<br>
</div>Did you see the 'Rcpp-extending.pdf' vignette about intrusive vs<br>
non-intrusive as<> and wrap?<br></blockquote><div><br></div></div><div>Sure, I have read that. This helps with the conversions, if I want to write the wrapper myself.</div><div><br></div><div>Ideally I would have the wrapper generated by Rcpp attributes. Essentially what I am asking for is the possibility to avoid adding the // [[Rcpp::export]] lines (and other attributes configuration) to the original sources, but having these lines in a separate file (or files?). This file would be essentially the description of the wrapper to be generated by Rcpp attributes.</div>

<div><br></div><div>I have to admit that I have only tried the Rcpp examples in the manuals so far, so please forgive me if what I am asking for is unreasonable, or is already solved.</div><div><br></div><div>[...]<br></div>
<div class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">| According to the docs, compileAttributes does not support this. Do you have<br>

</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>
| anything against implementing this in Rcpp? If not, and you can help me coming<br>
| up with some syntax that you like, I can code it up.<br>
<br>
</div>Attributes can surely be extended, but some discussion or prototyping may not<br>
hurt.<br></blockquote><div><br></div></div><div>OK, so I'll open an issue for this in your github issue tracker, and fork the repo as well.</div><div><br></div><div>G.</div><div><br></div><div>[...]</div></div></div>
</div>
</blockquote></div><br></div>