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

From: Simon Anders <anders_at_embl.de>
Date: Wed, 06 Jan 2010 16:26:26 +0100


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.


| 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

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 07 Jan 2010 - 12:35:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 07 Jan 2010 - 13:40:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive