Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Watal M. Iwasaki
Yes, escaping from the check seems difficult. I have created a quick PR on this for further discussion. Watal On Sat, Oct 27, 2018 at 2:13 AM Dirk Eddelbuettel wrote: > > Hi Watal, > > Thanks for being patient with me :) > > On 27 October 2018 at 01:26, Watal M. Iwasaki wrote: > | Sorry for my

Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Dirk Eddelbuettel
Hi Watal, Thanks for being patient with me :) On 27 October 2018 at 01:26, Watal M. Iwasaki wrote: | Sorry for my poor explanation. I have read | `inst/include/Rcpp/iostream/Rstreambuf.h` and think I understand the role | of Rcpp::Rcout, but failed to explain my point. By "users [...] can just

Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Watal M. Iwasaki
Dear Dirk, Sorry for my poor explanation. I have read `inst/include/Rcpp/iostream/Rstreambuf.h` and think I understand the role of Rcpp::Rcout, but failed to explain my point. By "users [...] can just stick to std::cout", I did not mean allowing users to write to stdout via std::cout. It is about

Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Dirk Eddelbuettel
Hi Watal, On 26 October 2018 at 23:36, Watal M. Iwasaki wrote: | Is it possible for Rcpp to do some pre-execution hook before user code? For | example, if Rcpp system can hijack the std::cout buffer by executing | `std::cout.rdbuf(Rcpp::Rcout.rdbuf())` automatically, then Rcpp users (and | exter

Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Watal M. Iwasaki
Dear Dirk, Is it possible for Rcpp to do some pre-execution hook before user code? For example, if Rcpp system can hijack the std::cout buffer by executing `std::cout.rdbuf(Rcpp::Rcout.rdbuf())` automatically, then Rcpp users (and external libraries) no longer have to care about Rcout, and can jus

Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Dirk Eddelbuettel
On 26 October 2018 at 22:03, Watal M. Iwasaki wrote: | Dear Dirk, | | Thank you for the prompt response. Good to know there is no easy way. I | have made up my mind to change the library code as you suggested. But I | don't like preprocessor macro; therefore, the problem here was solved by | mov

Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Watal M. Iwasaki
Dear Dirk, Thank you for the prompt response. Good to know there is no easy way. I have made up my mind to change the library code as you suggested. But I don't like preprocessor macro; therefore, the problem here was solved by moving/hiding `std::cout.rdbuf()` part into the library as a function

Re: [Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Dirk Eddelbuettel
On 26 October 2018 at 16:31, Watal M. Iwasaki wrote: | I have been working on an R interface package to a shared library written | in C++. It works almost perfectly, but the output to std::cout is not shown | on R console (on Linux). Of course Rcpp::Rcout should be used instead of | std::cout. But

[Rcpp-devel] How to handle std::cout/std::cerr in shared libraries

2018-10-26 Thread Watal M. Iwasaki
Hi all, I have been working on an R interface package to a shared library written in C++. It works almost perfectly, but the output to std::cout is not shown on R console (on Linux). Of course Rcpp::Rcout should be used instead of std::cout. But in this case I want to let the shared library be pur