[R-pkg-devel] Validate CRAN package using a linked library

Dirk Eddelbuettel edd at debian.org
Wed Sep 14 23:54:10 CEST 2016


On 14 September 2016 at 20:38, Martyn Plummer wrote:
| Most people who want to interface to an external library embed the source code of the library in their R package. I see that ginac is a C++ library which creates additional problems. Only a few R packages  interface to an external C++ library (e.g. the interfaces to SYMPHONY, gdal,  QuantLib, and JAGS).

No, there are lots more these days; look eg at many of the packages Jeroen
has added in the last year or two. 

I also have several few more, and/or helped a few.  nloptr is an example I
like because Jelmer and I generalized it to _either_ use embedded source
(slower build) or use the system library where present (ie Debian/Ubuntu).
 
| Windows is a problem because the toolchain used by R uses static linking to the C++ runtime. This has two  side effects:
| 
| 1)  Both the R package and the external DLL must be built with the same toolchain. So you can't just ask CRAN to install the Windows binary from the ginac web site.
| 
| 2) You can't throw an exception across DLL boundaries.
| 
| As Dirk says, this is hard.

Yes.  And getting libraries to Windows in a sane way is still an open
problem.  Some of us cheat by pulling prebuilt DLLs from, say, GitHub during
build time.  Works, but is more or less an open barn door waiting for trouble.

So in general: "it depends". But no shortcuts.

Dirk

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



More information about the R-package-devel mailing list