[Rcpp-devel] Thoughts on "wrapping" attributes

Tim Keitt tkeitt at utexas.edu
Sat Jan 4 00:48:43 CET 2014


On Fri, Jan 3, 2014 at 6:17 AM, JJ Allaire <jj.allaire at gmail.com> wrote:

> There is one way currently to get type definitions into RcppExports.cpp --
> simply add a header file with the same name as your package to
> inst/include. For example, if your package is named "foobar" then you place
> the type definitions in:
>
> inst/include/foobar.h
>
> This file will be automatically included in RcppExports.cpp. It will also
> be automatically included when another user does an Rcpp::depends on your
> package (for sourceCpp or compileAttributes) so they get the benefit of the
> type definitions as well).
>

Ah. Excellent. Thanks for the tip.

It would still be nice to have a means to autogenerate the R wrapper
without emitting the prototype as that will I think generate a
redeclaration error.

THK


>
> J.J.
>
>
> On Thu, Jan 2, 2014 at 1:11 PM, Tim Keitt <tkeitt at utexas.edu> wrote:
>
>> I am wondering if anyone has considered the following:
>>
>> // [[Rcpp::include(header.h, extC-bool, namesp-optional)]]
>>
>> to include header.h in RcppExports.cpp (optionally wrapping it with
>> extern "C" and putting it in a namespace)
>>
>> and
>>
>> // [[Rcpp::wrap(myType myFunc(const myType& x))]]
>>
>> which would do exactly what Rcpp::export does (generates a .Call-able
>> symbol + R function, but omits the prototype for myFunc in
>> RcppExports.cpp). That would allow the function and type definitions to
>> appear in header.h.
>>
>> THK
>>
>> --
>> http://www.keittlab.org/
>>
>> _______________________________________________
>> Rcpp-devel mailing list
>> Rcpp-devel at lists.r-forge.r-project.org
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>>
>
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>



-- 
http://www.keittlab.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140103/799d8aca/attachment.html>


More information about the Rcpp-devel mailing list