I mean, the .h and *.R files generated with Rcpp.package.skeleton seem to
have a simple structure that I find easy to replicate and modify as I keep
adding stuff to my *.cpp file. (For instance, the placement of RccpExport
before functions intended to be exported, the usage of SEXP,
etc). However, I do not clearly see how to go around the files generated
by compileAttributes and how to mix that with .R and *.h files previously
generated with Rcpp.package.skeleton. Any hints that can be provided here?
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).
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:
(1) Generating an Rcpp module declaration that includes all exported
functions; and
(2) Calling loadModule with the right list of functions in the
RcppExports.R file
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.