[Rcpp-devel] Using C++ class exposed by Module in R class

Stefan Boehringer (lumc) s.boehringer at lumc.nl
Fri Feb 6 17:19:36 CET 2015


Dear all,

I have the following problem:
I define a Referenceclass as follows

myClassObject = setRefClass('myClass', contains = c('class1', 'class2'),
    fields = list(
        reconstruction = 'ClassFromModule',
    ),
    methods = list(
    )
);

ClassFromModule is a C++ class exposed by a Rcpp Module. I had somewhat
irreproducible results with this approach.
On installing I get the following error message:

Error in refClassInformation(Class, contains, fields, methods, where) :
  class "ClassFromModule" for field 'reconstruction' is not defined

I can forward define the class by inserting:
setRefClass('ClassFromModule');
before the class definition.

Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
  ‘reconstructionsAll’ is not a valid field or method name for reference
class “Rcpp_ClassFromModule”

This problem appeared at some point in time as I have an installed
version of the package that did compile. However, I have not clue (and
understanding) what the expected behavior would be.


Is there a recipe available for using Rcpp exposed C++ classes in pure R
reference classes?

Thank you very much in advance, best,

    Stefan



-- 
http://s-boehringer.org




More information about the Rcpp-devel mailing list