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

Dorel, Mathurin mathurin.dorel at charite.de
Thu Sep 15 18:04:22 CEST 2016


Thanks for your replies,

I was not aware that LinkingTo was only a static linking. So no BH-like solution.
But how does the DLL pulling work then (I won't use it, it does not sound like a good practice but I'm curious)

I'll looked at nloptr, it looks like an elegant solution, I'll try that.

Mathurin

________________________________________
De : Dirk Eddelbuettel [edd at debian.org]
Envoyé : mercredi 14 septembre 2016 23:54
À : Martyn Plummer
Cc : Dirk Eddelbuettel; Dorel, Mathurin; r-package-devel at r-project.org
Objet : Re: [R-pkg-devel] Validate CRAN package using a linked library

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