[Rcpp-devel] How to create a new plugin?

Dominick Samperi djsamperi at gmail.com
Sat Dec 18 00:02:03 CET 2010


On Fri, Dec 17, 2010 at 12:37 PM, Romain Francois
<romain at r-enthusiasts.com>wrote:

> Le 17/12/10 01:28, Dominick Samperi a écrit :
>
>  Hello,
>>
>> I managed to create a new plugin by copy/paste/adapt
>> Rcpp.plugin.maker. Is there a better way?
>>
>> Thanks,
>> Dominick
>>
>
> Rcpp.plugin.maker is a sort of undocumented function we use for packages we
> write, just to avoid copy and paste.
>
> See how packages RcppArmadillo and RcppGSL use it.
>

Thanks Romain, that was a good tip. Now my adaptation has been reduced
to the following:

inlineCxxPlugin <- Rcpp:::Rcpp.plugin.maker(
         include.before = "#include <cxxPack.hpp>",
         libs = cxxPack:::LdFlags(),
         package = "cxxPack"
)

The only loose end is that sometimes I get a warning like this after
the unit testing completes for the first time (no warning if the unit
test is run again):

Warning messages:
1: In file(con, "r") :
  file("") only supports open = "w+" and open = "w+b": using the former
2: In file(con, "r") :
  file("") only supports open = "w+" and open = "w+b": using the former

I suspect this has something to do with how the Makefiles are opened.

BTW, it might be safer to leave it up to the test C++ code (assigned to
src) to optionally use 'using namespace whatever' instead of doing this
automatically, for the reasons Doug mentioned earlier.

Thanks,
Dominick


>
> Whether there is something better than what you have done is hard to tell
> since you are very sparse on details adn you did not show what ypu mean by
> copy/paste/adapt.
>
> Romain
>
> --
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://bit.ly/fT2rZM : highlight 0.2-5
> |- http://bit.ly/gpCSpH : Evolution of Rcpp code size
> `- http://bit.ly/hovakS : RcppGSL initial release
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20101217/41df785d/attachment.htm>


More information about the Rcpp-devel mailing list