[R-pkg-devel] Error handling in C code

Jarrod Hadfield j@h@d||e|d @end|ng |rom ed@@c@uk
Fri May 3 17:17:13 CEST 2024


Hi,

I have an R library with C code in it. It has failed the CRAN checks for Debian.  The problem is with the error function being undefined. Section 6.2 of the Writing R extensions (see below) suggests error handling can be handled by error and the appropriate header file is included in R.h, but this seems not to be the case?

Any help would be appreciated!

Thanks,

Jarrod

6.2 Error signaling

The basic error signaling routines are the equivalents of stop and warning in R code, and use the same interface.

void error(const char * format, ...);
void warning(const char * format, ...);
void errorcall(SEXP call, const char * format, ...);
void warningcall(SEXP call, const char * format, ...);
void warningcall_immediate(SEXP call, const char * format, ...);

These have the same call sequences as calls to printf, but in the simplest case can be called with a single character string argument giving the error message. (Don�t do this if the string contains �%� or might otherwise be interpreted as a format.)

These are defined in header R_ext/Error.h included by R.h.
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th� ann an Oilthigh Dh�n �ideann, cl�raichte an Alba, �ireamh cl�raidh SC005336.

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list