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
[R-pkg-devel] Use a small amount of C++-level code from another package without headers in inst/include
2 messages · Duncan Garmonsway, Dirk Eddelbuettel
On 4 July 2016 at 16:56, Duncan Garmonsway wrote:
| 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. Not quite. See below. | 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. If and only if the code is 'header-only'. Some C++ code is, as eg Armadillo in RcppArmadillo, the parts of Boost in BH, also StanHeaders, AsioHeaders etc pp but not all. If that package has code in src/ you need to link, or better use the exporting mechanism described in 'Writing R Extensions'. See below. | 2. Copy and acknowledge the code, which means propagating the GPL-3 licence | to my own package. This may be simplest. Copy it into your src/ and be done. Acknowledge the author, respect the copyright and license. | 3. Copy and pointlessly alter the code to evade copyright. You were told in no uncertain terms on SO that this is NOWHERE to be even considerable. This. Is. Never. An. Option. Do. Not. Repeat. It. | 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. This is a GPL violation which will get you off CRAN, and for a reason. | 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. Possibly export from it. See my RApiSerialize package for an example implementation. | (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). It is complicated. But rest assurred that actively cheating as you appear to suggest here is never correct. Dirk | 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]] | | ______________________________________________ | R-package-devel at r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-package-devel
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org