[Rcpp-devel] "Error during wrapup"

John Mous john.mous0 at gmail.com
Tue May 27 23:42:00 CEST 2014


I am passing back a very simple std::map<std::string, int> from Rcpp as

std::map<std::string, int> result;
result["X1"] = X1;
result["X2"] = X2;
result["X3"] = X3;
result["X4"] = X4;
return wrap(result);

The keys are hardcoded as shown, and the values X1-X4 are ints. Almost
always everything works fine, however, very intermittently, a vector is
returned on the R side _without_ named fields. For example:

Browse[1]> results
[1]   1   2 863   0
Error during wrapup: 'getCharCE' must be called on a CHARSXP
Browse[1]> str(results)
 atomic [1:4] 1 2 863 0
 - attr(*, "")= symbol X1
 - attr(*, "")= language `[[<-`(`*tmp*`, sim, value = 1L)

results[[X1]] works, but results[["X1"]] does not, and X2-X4 can be
retrieved only by index. However, again, most runs are successful:

Browse[1]> results
 X1  X2  X3  X4
   1    1 3254    0
Browse[1]> str(results)
 Named int [1:4] 1 1 3254 0
 - attr(*, "names")= chr [1:4] "X1" "X2" "X3" "X4"

I am using R 3.1.0 and Rcpp 0.11.1. Does the message "Error during wrapup:
'getCharCE' must be called on a CHARSXP" within this context hint anything
to anyone familiar with Rcpp's internals? I realize it's almost impossible
to diagnose with the given information -- is there a way to get Rcpp to
display more debugging information?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140527/e23ccd4b/attachment.html>

More information about the Rcpp-devel mailing list