[Rd] R_ext manual: type cast in C function registration

Simon Anders anders at embl.de
Wed Jan 6 16:26:26 CET 2010


Hi,

the "Writing R extensions" manual currently advises to register a .Call
function as follows:

   R_CallMethodDef callMethods[]  = {
       {"myCall", &myCall, 3},
       {NULL, NULL, 0}
   };

This produces a compiler warning, at least on my GCC, because the second
slot in the R_CallMethodDef is declared as DL_FUNC (which is declared as
'typedef void * (*DL_FUNC)();').

I'd suggest to change the example code in the manual to include an
explicit cast, i.e., 


   R_CallMethodDef callMethods[]  = {
       {"myCall", (DL_FUNC) &myCall, 3},
       {NULL, NULL, 0}
   };

in order to get rid of an unnecessary compiler warning.

Cheers
  Simon


+---
| Dr. Simon Anders, Dipl.-Phys.
| European Molecular Biology Laboratory (EMBL), Heidelberg
| office phone +49-6221-387-8632
| preferred (permanent) e-mail: sanders at fs.tum.de



More information about the R-devel mailing list