Displaying 2 results from an estimated 2 matches for "using_r".
Did you mean:
dusing_r
2006 Dec 14
1
Detecting compilation under R
The docs tell me:
"The header files define USING_R, which should be used to test if the
code is indeed being used with R."
but surely you only get that if you #include <R.h>, which you can only
do if you are using R. If you have code that you might want to compile
in R and for other purposes, how can you detect this?
As an example...
2001 Feb 23
1
using the .C interface to call compiled C code
Dear People,
I have been trying to learn how to use the .C interface. A friend gave me
a toy example, and I have been playing with it. It is
(C code)
#ifdef USING_R
typedef int Sint;
#else
typedef long Sint;
#endif
void kosum(double *a, double *b, Sint *na)
{
int i, j, nab;
double temp;
nab=*na;
temp=0.0;
for(i=0;i < nab; i++)
{
temp=temp+a[i];
}
*b=temp;
}
And the calling code in R is
test1<-
function(a, b)
{
.C(&q...