<div dir="ltr"><div>Dear Dirk,</div><div><br></div><div>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 just stick to std::cout.</div><div><br></div><div>Best,</div><div>Watal</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 26, 2018 at 10:12 PM Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On 26 October 2018 at 22:03, Watal M. Iwasaki wrote:<br>
| Dear Dirk,<br>
| <br>
| Thank you for the prompt response. Good to know there is no easy way. I<br>
| have made up my mind to change the library code as you suggested. But I<br>
| don't like preprocessor macro; therefore, the problem here was solved by<br>
| moving/hiding `std::cout.rdbuf()` part into the library as a function that<br>
| takes a streambuf pointer, and just calling it from Rcpp side. Now, output<br>
| is properly sent to R console, R CMD check complains nothing, and the<br>
| library still remains free from R/Rcpp code. Thanks again.<br>
<br>
Nicely done.<br>
<br>
We could do with a more general solution to this. If you have ideas ...<br>
<br>
Dirk<br>
<br>
-- <br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Watal M. Iwasaki / 岩嵜 航<br>SOKENDAI, The Graduate University for Advanced Studies,<br>Hayama, Kanagawa 240-0193, Japan<br>+81-46-858-1576<br><a href="https://heavywatal.github.io/" target="_blank">https://heavywatal.github.io/</a></div></div></div>