Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

* inst/unitTests/runit.exposeClass.R: Updated to pass with r-devel

* vignettes/rmd/Rcpp-FAQ.Rmd: Two new short section on speedier
compilation and lack of exceptions / stop() across shared libraries

2019-10-26 Dirk Eddelbuettel <edd@debian.org>

* vignettes/Rcpp-package.Rnw: Another wrapper
Expand Down
34 changes: 34 additions & 0 deletions vignettes/rmd/Rcpp-FAQ.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,23 @@ helps within this environment as it installs the corresponding
systems is provided
[at this page](https://conda.io/docs/user-guide/tasks/build-packages/compiler-tools.html).

## Can I speed up compilation?

Somewhat. One option is to cache as much as possible via
[ccache](https://ccache.dev/) by adding it to `~/.R/Makevars`.

Depending on what parts of Rcpp are being used, compilation speed can be
increased by turning use of Modules off. Starting with version 1.0.3, the
`RCPP_NO_MODULES` define can be used. It can be set in `src/Makevars` as
an argument to `PKG_CXXFLAGS` (or one of the other C++ dialect options) as
`-DRCPP_NO_MODULES`. This has the advantage of affecting _all_ files in the
package, including the auto-generated `RcppExports.cpp` where it might be
trickier to set it manually.

Beyond modules, RTTI support can also be turned off. this implies turning
Modules support off as well so. To select this approach, use the
`RCPP_NO_RTTI` define.

# Support

## Is the API documented
Expand Down Expand Up @@ -1720,3 +1737,20 @@ elsewhere.
So if your autogenerated file fails, and a `symbols not found` error is reported
by the linker, consider running `compileAttributes()` twice. Deleting
`R/RcppExports.R` and `src/RcppExports.cpp` may also work.

## Can we use exceptions and stop() across shared libraries?

Within limits, yes. Code that is generated via Rcpp Attributes (see
\citet{CRAN:Rcpp:Attributes} and Section~\ref{using-attributes}) generally
handles this correctly and gracefully via the `try-catch` layer it adds
shielding the exception from propagating to another, separate dynamic
library.

However, this mechanism relies on dynamic linking with the (system library)
`libgcc` providing the C++ standard library (as well as on using the same C++
standard library across all compiled components). But this library is linked
statically on Windows putting a limitation on the use of `stop()` from within
Rcpp Modules \citep{CRAN:Rcpp:Modules}. Some more background on the linking
requirement is [in this SO
question](https://stackoverflow.com/questions/2424836/exceptions-are-not-caught-in-gcc-program).