Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed missing Rcpp namespace in export interface generation #779

Merged
merged 1 commit into from
Dec 1, 2017
Merged

Fixed missing Rcpp namespace in export interface generation #779

merged 1 commit into from
Dec 1, 2017

Conversation

coatless
Copy link
Contributor

@coatless coatless commented Dec 1, 2017

This PR adds the Rcpp:: namespace prefix to an as<>() call in the Rcpp Attributes generation procedure for a C++ interface. e.g.,

// [[Rcpp::interfaces(r, cpp)]]

In particular, appending Rcpp::, fixes the following errors:

error: expected '(' for function-style cast or type construction
            throw Rcpp::exception(as<std::string>(rcpp_result_gen).c_str());
                                     ~~~~~~~~~~~^
error: no member named 'c_str' in 'Rcpp::RObject_Impl<PreserveStorage>'
            throw Rcpp::exception(as<std::string>(rcpp_result_gen).c_str());
                                                 ~~~~~~~~~~~~~~~~~ ^

@eddelbuettel
Copy link
Member

Can you remind me please in which issue ticket we discussed this?

@eddelbuettel
Copy link
Member

OTOH seems harmless and minimal enough to not even warrant a ChangeLog or NEWS entry. I mean it add what, six characters in one place?

@coatless
Copy link
Contributor Author

coatless commented Dec 1, 2017

We didn't. I avoided filing one as it is a one-line fix isolated to cross-package exports with:

// [[Rcpp::interfaces(r, cpp)]

But, yes. It literally added six characters that were missing, which prevented the compilation from working correctly.

@eddelbuettel
Copy link
Member

Out of curiousity, how did yout tickle this? That line has probably been three a while. I don't often set a cpp interface but as I recall I do in at least one package... Will just merge.

@eddelbuettel eddelbuettel merged commit 41ee833 into RcppCore:master Dec 1, 2017
@coatless
Copy link
Contributor Author

coatless commented Dec 1, 2017

I was using cpp interface to share code between multiple packages. The generation under the first package went okay, but while trying to generate an interface with the second package an error was raised.

@eddelbuettel
Copy link
Member

Nice. "Gallery post" ? I don't think we have usage examples of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants