Skip to content

Different Rcout object for each translation unit #928

Closed
@Enchufa2

Description

@Enchufa2

Opening this as per request of @kevinushey. As explained in this thread,

Rcout is defined in iostream/Rstreambuf.h as a static object. This means that different translation units see a different Rcout, while they see the same std::cout (I have a minimal package showing this if needed). As a result, for example, one object allocated in a certain cpp cannot redirect the output of other object allocated in another cpp.

And the same for Rcerr. I think that this might be worth fixing on the Rcpp side, but probably it would require to declare Rcout and Rcerr as extern and generate some code to initialise them in RcppExports.cpp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions