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

Add documentation for RCPP_EXPOSED_AS and similar macros in the vignette #416

Closed
MathurinD opened this issue Jan 13, 2016 · 5 comments
Closed
Assignees

Comments

@MathurinD
Copy link

Add a documentation for the macros RCPP_EXPOSED_AS, RCPP_EXPOSED_WRAP and RCPP_EXPOSED_CLASS in the "Extending Rcpp" vignette (https://cran.r-project.org/web/packages/Rcpp/vignettes/Rcpp-extending.pdf)

Not being aware of what they do can lead to problems with exposed pointers (Error: expecting an external pointer) when using both the macro and specializing template <> T as (SEXP).

@eddelbuettel
Copy link
Member

Can you draft a paragraph or two?

@MathurinD
Copy link
Author

How about putting it at the end of the "Non intrusive extension" subsection :

The macro \texttt{RCPP_EXPORT_WRAP} provides an easy way to expose a \proglang{C++} class to \proglang{R} as an external pointer. It can be used instead of specializing \texttt{Rcpp::wrap}, and should not be used simultaneously.

lang=cpp
#include RcppCommon.h
#include foobar.h

RCPP_EXPORT_WRAP(Bar);
@

for Rcpp::wrap and

The macro \texttt{RCPP_EXPORT_AS} provides an easy way to extend \texttt{Rcpp::as} to expose \proglang{R} external pointers to \proglang{C++}. It can be used instead of specializing \texttt{Rcpp::wrap}, and should not be used simultaneously.

lang=cpp
#include RcppCommon.h
#include foobar.h

RCPP_EXPORT_AS(Bar);
@

for Rcpp::as

And find somewhere to write:

The macro \texttt{RCPP_EXPOSED_CLASS} can be use to transparently exchange a class between \proglang{R} and \proglang{C++} as an external pointer, it can be used instead of both \texttt{Rcpp::wrap} and \texttt{Rcpp::as} specialization.

@coatless
Copy link
Contributor

coatless commented Aug 1, 2016

@eddelbuettel is what @MathurinD sufficient enough?

While in Rcpp-extending I'll probably also switch the initial example from cxxfunction() to sourceCpp() per #56.

@eddelbuettel
Copy link
Member

Probably good enough, and probably dropped the ball for July return. Next one ...

@coatless
Copy link
Contributor

Almost a year later...

@MathurinD what is your name? Presently, the attribution of the paragraphs is "MathurinD".

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

No branches or pull requests

3 participants