Re: [R-pkg-devel] Error checking in an independent C code and printing (perror, printf, etc.)

2022-09-09 Thread Jiří Moravec
I was hoping that you will tell me that R takes control of the C's stderr and stdout. That would make stuff easier. But I guess that is not really possible. I went the way suggested before and created an enum of error codes and a (static) const char* array of error messages. When reading

Re: [R-pkg-devel] Error checking in an independent C code and printing (perror, printf, etc.)

2022-09-07 Thread Dirk Eddelbuettel
On 7 September 2022 at 11:58, Ivan Krylov wrote: | there at all. On the other hand, my package that uses the | R_InitOutPStream and R_Serialize entry points seems to have passed the | CRAN review. A table of all public entry points including short | descriptions and whether they allocate could

Re: [R-pkg-devel] Error checking in an independent C code and printing (perror, printf, etc.)

2022-09-06 Thread Ivan Krylov
Hello Jiří and welcome to the mailing list! On Tue, 6 Sep 2022 14:48:02 +1200 "Jiří Moravec" wrote: > That brings me to a problem: How to do error handling in C without > the use of various <...> R-specific print functions? (Assuming that's what you meant...) One way would be to introduce

Re: [R-pkg-devel] Error checking in an independent C code and printing (perror, printf, etc.)

2022-09-06 Thread Duncan Murdoch
On 05/09/2022 10:48 p.m., Jiří Moravec wrote: Hello, this is my first time writing C code that interacts with R. To make my C code more modular, reusable, and easier to test with unittests, I split my code into: a) code that does stuff b) code that interfaces between a) and R. Only the b)