Skip to content

Commit 1bad53b

Browse files
riccardoporrecaeddelbuettel
authored andcommitted
Explicit Rcpp:: in the initalize method for C++ classes wrapped inside modules. (#980)
* Otherwise the Rcpp functions are unknown when objects are initialized, unless Rcpp is attached. * This is relevant for classes inside of modules created via Module(), both inline and in packages, but is not an issue when loadModule() is used for packages.
1 parent 84c787f commit 1bad53b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/Module.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ Module <- function( module, PACKAGE = methods::getPackageName(where), where = to
230230
.self <- .refClassDef <- NULL
231231
generator$methods(initialize =
232232
if(cpp_hasDefaultConstructor(CLASS))
233-
function(...) cpp_object_initializer(.self,.refClassDef, ...)
233+
function(...) Rcpp::cpp_object_initializer(.self,.refClassDef, ...)
234234
else
235235
function(...) {
236-
if(nargs()) cpp_object_initializer(.self,.refClassDef, ...)
237-
else cpp_object_dummy(.self, .refClassDef)
236+
if(nargs()) Rcpp::cpp_object_initializer(.self,.refClassDef, ...)
237+
else Rcpp::cpp_object_dummy(.self, .refClassDef)
238238
}
239239
)
240240
rm( .self, .refClassDef )

0 commit comments

Comments
 (0)