[Rd] R inline package

Troy Robertson troy.robertson2 at bigpond.com
Mon Mar 19 03:32:22 CET 2012


Hi all,

I am having some problems with the inline package and maybe someone can
point out what is going wrong?
I have developed a C++ library to assist with an S4 R project I have
been working on for some time.  I need to be able to include my package
using the setCMethod() function but it fails to find library header
files and/or the Rcpp.h header if I include that.  Yet if I use the
cfunction call first, the exact same setCMethod() call will then work.
I am assuming the Rcpp plugin is being called because of the Rcpp=TRUE
argument to cfunction(), which is setting up the paths to cause the
success of the later setCMethod?  I know the setCMethod() call will work
without the includes argument, but I need to be able to add the include
to my library, which also fails unless the cfunction() call has been
made first.

I am using R-2.14.1, Windows 7, inline (0.3.8), Rcpp (0.9.10).
I had to downgrade rTools to 2.14 because of the following problem I
encountered building my dll originally:
http://www.mail-archive.com/rcpp-devel@lists.r-forge.r-project.org/msg03133.html


example:

library(inline)
inc<-c("#include<Rcpp.h>");
sig<-signature(item="character")
code<-"return item;"
setCMethod("getSigItem", sig, body=code, includes=inc, Rcpp=TRUE,
verbose=TRUE)

The above call fails with:
fatal error: Rcpp.h: No such file or directory

The following call works fine:
f<-cfunction(sig, body=code, includes=inc, cppargs=cppa, libargs=liba,
Rcpp=TRUE, verbose=TRUE)

And now the same setCMethod call from above will work:
setCMethod("getSigItem", sig, body=code, includes=inc, Rcpp=TRUE,
verbose=TRUE)


Thanks for any help you can provide

Troy



More information about the R-devel mailing list