Skip to content
Prev 2358 / 10988 Next

[Rcpp-devel] package .onLoad multiple modules

Thanks, that is helpful. I think I have nailed down the problem.

I defined a wrapper at R level that used a C++ function from a module
named "cd",

circular_dichroism_spectrum <- function( ... ){

 [...] # some argument processing

  res <- cd$circular_dichroism_spectrum(...) # calling the C++ function

 return(res)
}

Now, with loadRcppModules(), no "cd" module is created, as far as I
can tell, and invoking circular_dichroism_spectrum() is calling the
C++ function directly; a segfault results because some of the
arguments differ between the C++ function and its R wrapper.

I see two options:

- choose a different name for the R and C++ functions

- manage some kind of namespace masking the C++ function from the
top-level, like cd$ did before. Is there a way to do this in the
loadRcppModules() approach?

Best regards,

baptiste
On 30 May 2011 11:11, Dirk Eddelbuettel <edd at debian.org> wrote: