<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi all,</div><div><br></div><div>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 pure C++. So I tried switching the stream buffers in the Rcpp side:</div><div>```<br></div><div><div><div><div>Rcpp::CharacterVector run(const std::vector<std::string>& args) {<br></div><div>    std::streambuf* obuf = std::cout.rdbuf(Rcpp::Rcout.rdbuf());<br></div><div>    mylib::Simulation simulation(args);<br></div><div>    simulation.run(); // std::cout is used in here</div><div>    std::cout.rdbuf(obuf);</div><div>    return "something";</div><div>}<br></div></div><div>```</div></div><div><br></div><div><div>It (seemingly) works! But now `devtools::check()` produces 1 note:</div><div><div><div>```<br></div></div></div></div><div>❯ checking compiled code ... NOTE</div><div>  File ‘mylib/libs/mylib.so’:</div><div>    Found ‘__ZNSt3__14coutE’, possibly from ‘std::cout’ (C++)<br></div><div>      Object: ‘run.o’</div><div><br></div><div>  Compiled code should not call entry points which might terminate R nor</div><div>  write to stdout/stderr instead of to the console, nor use Fortran I/O</div><div>  nor system RNGs.</div><div>```</div><div><br></div><div>Can I suppress this note? or should I just ignore it? any other good solution?</div><div><br></div><div>Thanks,</div></div><div dir="ltr" class="gmail_signature"><div dir="ltr">Watal M. Iwasaki</div><div dir="ltr"><br></div></div></div></div></div>