|
1 | | -// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- |
2 | | -// |
3 | 1 | // Rcpp_init.cpp : Rcpp R/C++ interface class library -- Initialize and register |
4 | 2 | // |
5 | | -// Copyright (C) 2010 - 2017 John Chambers, Dirk Eddelbuettel and Romain Francois |
| 3 | +// Copyright (C) 2010 - 2020 John Chambers, Dirk Eddelbuettel and Romain Francois |
6 | 4 | // |
7 | 5 | // This file is part of Rcpp. |
8 | 6 | // |
@@ -121,22 +119,27 @@ void registerFunctions(){ |
121 | 119 | RCPP_REGISTER(error_occured) |
122 | 120 | RCPP_REGISTER(rcpp_get_current_error) |
123 | 121 | // RCPP_REGISTER(print) |
| 122 | + RCPP_REGISTER(Rcpp_precious_init) |
| 123 | + RCPP_REGISTER(Rcpp_precious_teardown) |
| 124 | + RCPP_REGISTER(Rcpp_precious_preserve) |
| 125 | + RCPP_REGISTER(Rcpp_precious_remove) |
124 | 126 | #undef RCPP_REGISTER |
125 | 127 | } |
126 | 128 |
|
127 | | - |
128 | | -extern "C" void R_unload_Rcpp(DllInfo *) { // #nocov start |
129 | | - // Release resources |
130 | | -} // #nocov end |
| 129 | +extern "C" void R_unload_Rcpp(DllInfo *) { // #nocov start |
| 130 | + Rcpp::Rcpp_precious_teardown(); // release resource |
| 131 | +} // #nocov end |
131 | 132 |
|
132 | 133 | extern "C" void R_init_Rcpp(DllInfo* dllinfo) { |
133 | 134 | setCurrentScope(0); |
134 | 135 |
|
135 | | - registerFunctions(); // call wrapper to register export symbols |
| 136 | + registerFunctions(); // call wrapper to register export symbols |
| 137 | + |
| 138 | + R_useDynamicSymbols(dllinfo, FALSE); // set up symbol symbol lookup (cf R 3.4.0) |
136 | 139 |
|
137 | | - R_useDynamicSymbols(dllinfo, FALSE); // set up symbol symbol lookup (cf R 3.4.0) |
| 140 | + init_Rcpp_cache(); // init the cache |
138 | 141 |
|
139 | | - init_Rcpp_cache(); // init the cache |
| 142 | + Rcpp::Rcpp_precious_init(); |
140 | 143 |
|
141 | | - init_Rcpp_routines(dllinfo); // init routines |
| 144 | + init_Rcpp_routines(dllinfo); // init routines |
142 | 145 | } |
0 commit comments