Skip to content

nCompile with package=TRUE when a free nFunction has an nClass argument fails #197

@perrydv

Description

@perrydv

reprex:

nc <- nClass(
  Cpublic = list(
    x = 'numericVector'
  )
)
nf <- nFunction(
  function(obj = 'nc') {
  }
)
comp <- nCompile(nc, nf, package = TRUE) # FAILS
comp$nf(comp$nc$new())

The problem is that RcppExports.cpp needs to see the header file for the nc nClass (which would be nClass_1_ or such), because std::shared_ptr<nClass_1_> appears in the code Rcpp::compileAttributes creates in RcppExports.cpp for nf. We have test coverage of passing nClasses as arguments, but evidently either that happens only for nClass methods (in which case only the new_<type> function for the class is in RcppExports.cpp) or the package=TRUE pathway is not used (in which case nCompile succeeds).

A possible solution would be to generate a standard all.h that can be included simply in RcppExports.cpp and that includes all generated headers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions