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