You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/Rcpp-attributes.Rmd
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -650,6 +650,30 @@ step may be required. Specifically, if your package `NAMESPACE` file
650
650
does not use a pattern to export functions then you should add an explicit
651
651
entry to `NAMESPACE` for each R function you want publicly available.
652
652
653
+
## Package Init Functions
654
+
655
+
Rcpp attribute compilation will automatically generate a package R_init function that does native routine registration as described here: <https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Registering-native-routines>.
656
+
657
+
You may however want to add additional C++ code to the package initialization sequence. To do this, you can add the `[[Rcpp::init]]` attribute to functions within your package. For example:
658
+
659
+
```{cpp, eval = FALSE}
660
+
// [[Rcpp::init]]
661
+
void my_package_init(DllInfo *dll) {
662
+
// initialization code here
663
+
}
664
+
```
665
+
666
+
In this case, a call to `my_package_init()` will be added to the end of the automatically generated R_init function within RcppExports.cpp. For example:
0 commit comments