[Rcpp-devel] Different Rcout object for each translation unit

Kevin Ushey kevinushey at gmail.com
Mon Dec 3 20:32:31 CET 2018


I think this might be worth fixing on the Rcpp side -- there should
really only be one instance of the Rcout object. Would you mind filing
an issue at https://github.com/RcppCore/Rcpp/issues, so we don't lose
track of this?

You could of course just create your own Rcout / Rcerr objects as well
(the Rstreambuf class is public and part of the Rcpp namespace).

Kevin

On Mon, Dec 3, 2018 at 10:34 AM Iñaki Ucar <iucar at fedoraproject.org> wrote:
>
> Hi,
>
> 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. Is there any solution to this (apart from putting everything in
> a huge .cpp)?
>
> Regards,
> --
> Iñaki Úcar
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


More information about the Rcpp-devel mailing list