Skip to content

Commit d26672c

Browse files
committed
two (short) new entries for Rcpp-FAQ vignette
1 parent ee0a5b8 commit d26672c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

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

21+
* vignettes/rmd/Rcpp-FAQ.Rmd: Two new short section on speedier
22+
compilation and lack of exceptions / stop() across shared libraries
23+
2124
2019-10-26 Dirk Eddelbuettel <[email protected]>
2225

2326
* vignettes/Rcpp-package.Rnw: Another wrapper

vignettes/rmd/Rcpp-FAQ.Rmd

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,23 @@ helps within this environment as it installs the corresponding
12061206
systems is provided
12071207
[at this page](https://conda.io/docs/user-guide/tasks/build-packages/compiler-tools.html).
12081208

1209+
## Can I speed up compilation?
1210+
1211+
Somewhat. One option is to cache as much as possible via
1212+
[ccache](https://ccache.dev/) by adding it to `~/.R/Makevars`.
1213+
1214+
Depending on what parts of Rcpp are being used, compilation speed can be
1215+
increased by turning use of Modules off. Starting with version 1.0.3, the
1216+
`RCPP_NO_MODULES` define can be used. It can be set in `src/Makevars` as
1217+
an argument to `PKG_CXXFLAGS` (or one of the other C++ dialect options) as
1218+
`-DRCPP_NO_MODULES`. This has the advantage of affecting _all_ files in the
1219+
package, including the auto-generated `RcppExports.cpp` where it might be
1220+
trickier to set it manually.
1221+
1222+
Beyond modules, RTTI support can also be turned off. this implies turning
1223+
Modules support off as well so. To select this approach, use the
1224+
`RCPP_NO_RTTI` define.
1225+
12091226
# Support
12101227

12111228
## Is the API documented
@@ -1720,3 +1737,11 @@ elsewhere.
17201737
So if your autogenerated file fails, and a `symbols not found` error is reported
17211738
by the linker, consider running `compileAttributes()` twice. Deleting
17221739
`R/RcppExports.R` and `src/RcppExports.cpp` may also work.
1740+
1741+
## Can we use exceptions and stop() across shared libraries?
1742+
1743+
No, sadly. A known limitation coming from the operating system, Windows in
1744+
particular. Exceptions cannot be caught safely as R is statically linked
1745+
with `libgcc` there. Some more background is [in this SO
1746+
question](https://stackoverflow.com/questions/2424836/exceptions-are-not-caught-in-gcc-program).
1747+

0 commit comments

Comments
 (0)