[Rd] Calling C functions with value parameters

Duncan Murdoch murdoch at stats.uwo.ca
Tue Aug 18 13:50:07 CEST 2009


On 17/08/2009 10:23 AM, Jeffrey J. Hallman wrote:
> One hassle I could do without is the necessity of writing C wrapper functions
> like this:
> 
> void fameInit(int *status){
>   cfmini(status);
>   return;
> }
> 
> when I want to call a library function (cfmini, in this case) that takes an
> int argument.  The .C interface only lets me pass a pointer to an int, rather
> than the int itself.
> 
> Is there any chanch that .C could be enhanced to allow passing arguments by
> value to the compiled code?  It would make some of my stuff much simpler.

What you have above doesn't work (you passed the pointer, not the 
value), but it's hardly complex.  I don't think the effort of extending 
.C in that way would be a worthwhile use of time.

Duncan Murdoch



More information about the R-devel mailing list