[Rcpp-devel] Building shared libs with Rcpp does not work as before after Debian update

Dirk Eddelbuettel edd at debian.org
Tue Mar 18 12:35:39 CET 2014


On 18 March 2014 at 11:43, Andreas Recke wrote:
| ************* in R console ****************
| 
| >dyn.load("test.so")
| >.Call("norm_wrapper", x_=2, y_=3)
| 
| and I get the error message, that function "dataptr" is not provided by
| package "Rcpp" ...

As documented in the release notes for Rcpp 0.11.0, you need to rebuild all
packages that use R. In this case RcppArmadillo. Uninstall RcppArmadillo, and
reinstall, preferably from source.

You can also _greatly_ simplify your example by using this file:

--- file /tmp/andreas.cpp ---------------------------------------------------

#include <iostream>
#include <iomanip>
#include <cmath>
#include <RcppArmadillo.h>

using namespace Rcpp;

// [[Rcpp::depends(RcppArmadillo)]]

// [[Rcpp::export]]
double andreas_norm(double x, double y) {
  return sqrt(x*x + y*y);
}

-----------------------------------------------------------------------------

after which you simply do:

   R> library(Rcpp)
   R> sourceCpp("/tmp/andreas.cpp")    ## the Rcpp Attributes vignette
   R> andreas_norm(0.5, 2.5)
   [1] 2.54951
   R> 

No environment variable, no external compile, no dyn.load, no .Call() -- it
is all taken care of by sourceCpp().

Dirk

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


More information about the Rcpp-devel mailing list