[Rcpp-devel] Local .h files and Rcpp attributes

Mark Fredrickson mark.m.fredrickson at gmail.com
Sat Oct 19 05:13:10 CEST 2013


Hello,

Short version: Is it possible to instruct the code generator in
`compileAttributes` to source local header files when generating
RcppExports.cpp?

Long version: I'm trying to crib from the Dirk's examples in his recent UCB
talk examples about function pointers (
http://dirk.eddelbuettel.com/papers/rcpp_booth_uofc_oct2013-part2.pdf). In
it, he uses a `typedef` to define the type of his function call. This is
all great if using `sourceCpp` to slurp in the file directly, but I'm
getting errors when compiling a package. I'd like to use attributes to
export my functions at both the R level and as the target of function
pointers, but this may be incompatible with attributes, at least at some
level.

My (perhaps naive) attempts are giving errors about my `funcPtr` type not
being defined. I've tried moving this definition to a header file, but even
with `//[[Rcpp::depends(myheader)]]` or `\\[Rcpp::depends(myheader.h)]]`,
the generated RcppExports.cpp file does not include `myheader.h`.

My (non-working) code can be found at:

https://github.com/markmfredrickson/RItools/blob/ri-rcpp/src/teststatistics.cpp

Thanks in advance,

-M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131018/bbad1560/attachment.html>


More information about the Rcpp-devel mailing list