Hi, I've read this note a few times and still find myself similarly confused. Does the new compileAttributes() for //[[Rcpp::export]] tagged functions intend to provide a more streamlined alternative to employment of RcppExport inclusions in declarations in the header file and subsequent use of .Call() to use a package c++ file within the R files that compose the package? Presently, I use .Call for exported c++ functions and wrap them in associated R functions within the R files that compose my package and write documentation (processed by roxygen2) at the R-layer for the wrapped C++ function. The resulting functions are typically used in other R functions of my package. Is the more streamlined suggested path to compose the documentation statements directly to the C++ layer and then simply load RcppExports.R, using an #' @include RcppExports.R at the R layer within a package to allow roxygen2 to add to collated files in the package Description file such that they would then be readily available within the R files of the package for developer use? Under the new scheme, do I no longer need to include RcppExport in my .h file if I appropriately employ //[[Rcpp::export]]? All to say, it is unclear to me whether the intended use of compileAttributes() is solely to help package writers allow package users to more easily access the c++ functions at the R layer or additionally to also streamline how package developers source c++ files within their own package development process under Rcpp.<div>
<br></div><div>Thanks, as always, for your work and expertise.</div><div><br></div><div>Terrance Savitsky</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 15, 2012 at 11:18 AM, JJ Allaire <span dir="ltr"><<a href="mailto:jj.allaire@gmail.com" target="_blank">jj.allaire@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font face="arial,helvetica,sans-serif"><br></font><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1. Suggestion: it might be appropriate to say (probably before 5.1) that<br>
Makevars, etc, are still needed. And, thus, point the reader to<br>
vignette("Rcpp-package").<br></blockquote><div><br></div></div><div>Very good suggestion -- will do!</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I mean, the .h and *.R files generated with Rcpp.package.skeleton seem to<br>
have a simple structure that I find easy to replicate and modify as I keep<br>
adding stuff to my *.cpp file. (For instance, the placement of RccpExport<br>
before functions intended to be exported, the usage of SEXP,<br>
etc). However, I do not clearly see how to go around the files generated<br>
by compileAttributes and how to mix that with .R and *.h files previously<br>
generated with Rcpp.package.skeleton. Any hints that can be provided here?<br></blockquote><div><br></div></div><div>The files generated by compileAttributes provide the bindings to R for the exported functions. They are designed to sit alongside your other source files and you don't ever modify these files directly (they are regenerated as necessary by compileAttributes). </div>
<div><br></div><div>The core notion is that by placing the Rcpp::export attribute before a function you've done everything you need to do and we'll take care of the rest. This entails:</div><div><br></div><div>(1) Generating an Rcpp module declaration that includes all exported functions; and </div>
<div>(2) Calling loadModule with the right list of functions in the RcppExports.R file</div><div><br></div><div>The optional <PackageName.h> file is a bit more complicated because it interacts with R_GetCCallable. It too is generated so not something you hand maintain. We are working on a mechanism to mix generated and user code in inst/include and hope to have that ready for the next release.</div>
<div><br></div><div><br></div><div><br></div></div>
<br>_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br></blockquote></div><br><br clear="all"><div>
<br></div>-- <br>Thank you, Terrance Savitsky<br>
</div>