[R-pkg-devel] Use a small amount of C++-level code from another package without headers in inst/include
Duncan Garmonsway
nacnudus at gmail.com
Mon Jul 4 17:56:25 CEST 2016
There is an R package that defines some handy functions for extracting
files from zip archives into a std::string in C++. I'd like to use those
functions in my own packages, but I can't simply link to them because the
header is not in the inst/include directory of the original package.
My question is based on my understanding that C++-level code isn't
available outside a package unless the header is in inst/include.
To use the code, my options are:
1. Ask the package maintainer to move the C++ header file to the
inst/include directory so that I can call it from my package with linkingTo
in the DESCRIPTION file.
2. Copy and acknowledge the code, which means propagating the GPL-3 licence
to my own package.
3. Copy and pointlessly alter the code to evade copyright.
4. Copy the code, which is about 20 lines, don't alter it, don't
acknowledge it, and don't propagate the GPL-3 licence.
5. Create a separate, tiny package that makes the code I want available in
inst/include, acknowledges the original author, and propogates the GPL-3
licence to itself, but not to my actual package, which simply includes it.
(There seems to be some doubt about the propagation of licences, but I
have read an archive post that said this is not an appropriate forum to
discuss that).
Are there any other options? Have I misunderstood Writing R Extensions or
Rcpp?
(3) and (4) aren't serious, but they become more tempting for more-trivial
code (e.g. at what point is it equivalent to copy/pasting StackOverflow
answers?)
I originally posted this question at StackOverfow, where I was directed
here.
Thanks,
Duncan
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list