[Rcpp-devel] Re-using C++ code from a package with modules and defining linker flags using Rscript

Jelmer Ypma jelmerypma at gmail.com
Mon May 16 10:28:23 CEST 2011


Thanks for both your replies. I got it working the way I wanted. If
someone's interested, a simple example with two packages can be
downloaded here: http://www.ucl.ac.uk/~uctpjyy/downloads/RcppEx.zip

QuadFunc defines a C++ class that is used in C++ code in QuadFuncVec.

Jelmer

On Mon, May 16, 2011 at 00:30, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 15 May 2011 at 17:22, Douglas Bates wrote:
> | On May 15, 2011 5:17 PM, "Dirk Eddelbuettel" <edd at debian.org> wrote:
> | > On 15 May 2011 at 21:42, Jelmer Ypma wrote:
> | > | Is this the recommended way of adding linker and cxx flags to packages
> | > | depending on other R packages with modules? I tried to look at
> | >
> | > We simply show no example of definiting object code in one package and having
> | > other packages use it -- with the exception of the Rcpp package itself.  And
> | > there it takes quite some effort to make this happen.
> | >
> | > You could look at what lme4 and Matrix do; this is documented in the 'Writing
> | > R Extensions' manual under '[Section] 5.4 Registering native routines'.
> |
> | Unfortunately that approach doesn't work with C++ classes and methods, which is
> | one of the reasons that Rcpp linkage has to be done the way that it is.  The
> | exporting of symbols a as done by Matrix is restricted to C function entry
> | points.
>
> Ah, yes, that aspect too. Meant to mention, thanks for catching it.
>
> In short: no beans.  You may have to build one larger package.
>
> Dirk
>
> --
> Gauss once played himself in a zero-sum game and won $50.
>                      -- #11 at http://www.gaussfacts.com
>


More information about the Rcpp-devel mailing list