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

Conversation

Projects
None yet
2 participants
@coatless
Contributor

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

This comment has been minimized.

Member

eddelbuettel commented Dec 1, 2017

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

@eddelbuettel

This comment has been minimized.

Member

eddelbuettel commented Dec 1, 2017

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Member

eddelbuettel commented Dec 1, 2017

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@coatless

This comment has been minimized.

Contributor

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

This comment has been minimized.

Member

eddelbuettel commented Dec 1, 2017

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