[Rcpp-devel] unable to load shared object - Symbol not found

Dirk Eddelbuettel edd at debian.org
Sun Jul 16 15:30:55 CEST 2017


One of your other problems is that you mix twenty-eight generated function
interfaces (via the Rcpp::exports() tag, the recommended approach) with the
very old-school approach of two remaining manual .Call() in your R/hef.R.

That conflicts with us now using underscores, as the symbol name still used
by you in .Call() now also needs the underscore.

That is not a battle we can win: either we try to help everybody by 'hiding'
unexported symbols by prefixing with an underscore, or allow random mixing of
Rcpp Attributes with .Call.  I prefer the former.

My diff to two files is below. The only other change is in the generated
RcppExports.{R,cpp} files.

Dirk

/tmp/rpbl(master)$ git diff src/heffter.cpp
diff --git a/src/heffter.cpp b/src/heffter.cpp
index e001dfa..5df9294 100644
--- a/src/heffter.cpp
+++ b/src/heffter.cpp
@@ -97,7 +97,7 @@ vector<double> _heff(vector<double>& t, vector<double>& h, double min_h,
 vector<double> _heff2(vector<double>& t, vector<double>& p,
                       vector<double>& h, vector<double> dew = vector<double>(),
                       double min_h = 0.0,
-                      double max_h = numeric_limits<double>::infinity(),
+                      double max_h = 1.79769e+308, 
                       double dt = 2.0, double dt_dz = 0.005,
                       bool top_of_sbi = true, double sbi_th = 50.0,
                       bool use_max_lapse = false,
@@ -130,7 +130,7 @@ NumericVector hef(const NumericVector& t, const NumericVector& h,
 // [[Rcpp::export]]
 NumericVector hef2(NumericVector t, NumericVector p,
                    NumericVector h, Nullable<NumericVector> dew,
-                   double min_h = 0.0, double max_h = numeric_limits<double>::infinity(),
+                   double min_h = 0.0, double max_h = 1.79769e+308,
                    double dt = 2.0, double dt_dz = 0.005,
                    bool top_of_sbi = true, double sbi_th = 50.0,
                    bool use_max_lapse = false,
@@ -149,7 +149,7 @@ NumericVector hef2(NumericVector t, NumericVector p,
 }
 
 NumericVector hef_df(DataFrame& x, bool virt = false,
-                     double min_h = 0.0, double max_h = numeric_limits<double>::infinity(),
+                     double min_h = 0.0, double max_h = 1.79769e+308,
                      double dt = 2.0, double dt_dz = 0.005,
                      bool top_of_sbi = true, double sbi_th = 50.0,
                      bool use_max_lapse = false,
@@ -170,7 +170,7 @@ NumericVector hef_df(DataFrame& x, bool virt = false,
 
 // [[Rcpp::export]]
 List hef_list(List& x, bool virt = false,
-              double min_h = 0.0, double max_h = numeric_limits<double>::infinity(),
+              double min_h = 0.0, double max_h = 1.79769e+308,
               double dt = 2, double dt_dz = 0.005,
               bool top_of_sbi = true, double sbi_th = 50.0,
               bool use_max_lapse = false,
/tmp/rpbl(master)$ 

/tmp/rpbl(master)$ git diff R/hef.r
diff --git a/R/hef.r b/R/hef.r
index 1ed52bb..a136407 100644
--- a/R/hef.r
+++ b/R/hef.r
@@ -43,7 +43,7 @@ hef.default <- function(p, h, t, dew = NULL, hlim = range(h),
   hlim <- range(hlim)
 
   p <- df[,1]; h <- df[,2]; t <- df[,3]; if (virt) dew <- df[,4]
-  pbl <- .Call('rpbl_hef2', PACKAGE = 'rpbl', t, p, h, dew, hlim[1], hlim[2],
+  pbl <- .Call('_rpbl_hef2', PACKAGE = 'rpbl', t, p, h, dew, hlim[1], hlim[2],
                dt, dtdz, top.of.sbi, sbi.th, use.max.lapse, relax, smooth3p)
   pbl[is.nan(pbl)] <- as.numeric(NA);
   lvl <- c(type = pbl[1], base = pbl[2], top = pbl[3],
@@ -95,7 +95,7 @@ hef.list <- function(x, virt = FALSE, hlim = NA,
     hlim <- c(0, Inf)
   }
   hlim <- range(hlim)
-  ret <- .Call('rpbl_hef_list', PACKAGE = 'rpbl', x, virt, hlim[1], hlim[2], dt,
+  ret <- .Call('_rpbl_hef_list', PACKAGE = 'rpbl', x, virt, hlim[1], hlim[2], dt,
                dtdz, top.of.sbi, sbi.th, use.max.lapse, relax, smooth3p)
   return(ret);
-}
\ No newline at end of file
+}
/tmp/rpbl(master)$ 


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


More information about the Rcpp-devel mailing list