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

2013-10-23 Thread Romain Francois
Le 19/10/13 22:06, JJ Allaire a écrit : For it to actually work though we'd need to modify Makevars as well (as Romain pointed out) so that the RcppExports.cpp could see the include file. IMO, R should do this. R should recognize that a package has a inst/include directory and automatically

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

2013-10-23 Thread Romain Francois
Le 19/10/13 22:37, JJ Allaire a écrit : Another alternative would be to create a new mechanism: an RcppExports.h file written into src (and thus not requiring modification of Makevars). This could include a comment explaining that anything extra the user wants in RcppExports.cpp should be

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

2013-10-23 Thread Dirk Eddelbuettel
On 20 October 2013 at 12:55, Mark Fredrickson wrote: | I wanted to thank everyone for help on this. Putting the typedef in a header | (inst/include/RItools.h) the export function would auto-include was exactly | what I was looking for. This discussion also prompted me to think a little more |

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

2013-10-23 Thread Mark Fredrickson
I wanted to thank everyone for help on this. Putting the typedef in a header (inst/include/RItools.h) the export function would auto-include was exactly what I was looking for. This discussion also prompted me to think a little more about the interface my package should export should anyone else

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

2013-10-23 Thread Jonathan Olmsted
I just wanted to jump in here. Mark, I'm going to email you off the list to chat about a Gallery post. It looks like we wanted to know roughly the same thing at roughly the same time. For this email, I just wanted to allay fears amongst the helpers that their help in the last week on this topic

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

2013-10-19 Thread Mark Fredrickson
The same trick was already used in RcppDE (which was a proof of concept about converting DEoption from 700 lines of plain C to 400 lines of C++ / Rcpp) where I have typedef double (*funcPtr)(SEXP); and the rest works like a 'plain old package'. Certainly. And while I haven't

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

2013-10-19 Thread Romain Francois
Le 19/10/13 05:13, Mark Fredrickson a écrit : 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

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

2013-10-19 Thread Dirk Eddelbuettel
On 19 October 2013 at 17:55, Romain Francois wrote: | Try putting your declarations into a RItools.h file in inst/include/ or | src/ in your package, i.e. have this in RItools.h | | typedef double (*testStat)(NumericVector, NumericVector); | | and add: | | PKG_CPPFLAGS += -I../inst/include/

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

2013-10-19 Thread JJ Allaire
RcppExports.cpp will automatically include a .h that has the same name as the package and is located in inst/include, iirc. This is indeed the current solution to the problem of typedefs, however I admin that it's a bit difficult to take advantage of without wading through documentation and/or

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

2013-10-19 Thread Dirk Eddelbuettel
On 19 October 2013 at 15:14, JJ Allaire wrote: | RcppExports.cpp will automatically include a .h that has the same name as | the package and is located in inst/include, iirc. Hah! | This is indeed the current solution to the problem of typedefs, however I admin | that it's a bit

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

2013-10-19 Thread JJ Allaire
Maybe you could follow the example of Rcpp.package.skeleton() and just drop an empty yet amply commented file there? By being there users have a better chance of stumbling over it :) Since this would involve creating a new directory (inst/include) perhaps I could instead emit comments at the

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

2013-10-19 Thread Dirk Eddelbuettel
On 19 October 2013 at 15:40, JJ Allaire wrote: | | Maybe you could follow the example of Rcpp.package.skeleton() and just drop | an empty yet amply commented file there?  By being there users have a | better chance of stumbling over it :) | | | Since this would involve creating a

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

2013-10-19 Thread JJ Allaire
For it to actually work though we'd need to modify Makevars as well (as Romain pointed out) so that the RcppExports.cpp could see the include file. This might get trickly. My thought was that we should either generate a fully working solution or failing that generation enough

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

2013-10-19 Thread Dirk Eddelbuettel
On 19 October 2013 at 16:06, JJ Allaire wrote: | For it to actually work though we'd need to modify Makevars as well (as Romain | pointed out) so that the RcppExports.cpp could see the include file. This might | get trickly. Well right now we simply set people up to fail / having to create it

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

2013-10-18 Thread Mark Fredrickson
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 (