[Rd] Rcpp - Linking to DLL from another package?

Dirk Eddelbuettel edd at debian.org
Mon Dec 18 14:40:35 CET 2017


(Moderately wrong list: r-package-devel for packaging questions, rcpp-devel
for Rcpp questions)

On 18 December 2017 at 13:24, Stravs, Michael wrote:
| I am trying to make a package B that extends another package A. Package A uses Rcpp, and I want to extend a class X used there.

It doesn't really matter (for the issue at hand) if you use Rcpp or not -- R
only offers us C interfaces so C interfaces are all we got. And they don't
know classes.

I worked through that in some of my packages. See eg RcppXts which "extends"
in your sense xts by allowing C++ level access from another package. The one
key aspect is that _everything you want to call from B must be explicitly
exported by A_.  See Writing R Extensions for details.

If you could rewrite your class A to be header-only then you could just
include it via LinkingTo. But that is a different story.

In short, "No Free Lunch" and no automagic mechanisms.

Dirk

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



More information about the R-devel mailing list