Skip to content
Prev 33641 / 63424 Next

Calling C functions with value parameters

Jeff,
On Aug 17, 2009, at 10:23 , Jeffrey J. Hallman wrote:

            
IMHO close to 0, because there is not such a thing as "scalar int" in  
R. All objects in R are arrays (in C speak), so in all three:
foo(integer(0)), foo(1L), foo(1:10)
the argument is of the same type: integer vector (analogously C type  
int[]). In fact .C should preferably not be used for wrappers like the  
one you suggested, because it's more prone to errors and much less  
flexible than .Call which gives you all you want including the control  
over duplication and the length of the supplied arguments.

(There are some packages that can generate wrappers from function  
arguments or header files - maybe the authors can comments on that if  
they wish).

Cheers,
Simon