[Rcpp-devel] Makevars portability

Dirk Eddelbuettel edd at debian.org
Sat Mar 3 18:52:57 CET 2018

On 3 March 2018 at 09:32, Jeff Newmiller wrote:
| I have an existing legacy.c file with legacy.h interface that I am putting into a package. I figured out how to create an rcpp glue file that uses an extern "C" block to include the .h file so my C++ function can call it.
| However, it looks like Rcpp is defining the OBJECTS variable before I put legacy.o in, so I have had to use
| OBJECTS += legacy.o
| in the Makevars file so it will compile and link the legacy code in along with the object files setup by Rcpp,  but R CMD check complains about portability.
| Is there a way to do this that does not irritate R CMD check?

In the simplest cases you need _nothing_ in src/Makevars. Just drop files
src/legacy.{c,h} and, say, src/legacyWrapper.cpp in src/, and everything
should work.

That is what the skeleton package does.  (For RcppArmadillo we need to link
to BLAS/LAPACK/Fortran/... but not here.)

So if you check existing packages (easy to browse on GitHub too) you should
notice that very few, possibly none, set OBJECTS.  None of mine do, methinks.


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list