Displaying 1 result from an estimated 1 matches for "orthofunctions".
2010 Jun 18
4
C Interface
...P result;
PROTECT(result = NEW_NUMERIC(1));
double* ptr=NUMERIC_POINTER(result);
double t = *REAL(s);
double u = t-floor(t)-0.5;
if(u>0) *ptr=-1+4*u; else *ptr=-1-4*u;
Rprintf("The value is %f", *ptr);
UNPROTECT(1);
return result;
}
};
It is compiled with
R CMD SHLIB OrthoFunctions.c
with flag
MAKEFLAGS="CC=g++"
However when I call this code from R with
test <- function(t){
.Call("test",t)
}
dyn.load("./OrthoFunctions.dll")
test(0)
dyn.unload("./OrthoFunctions.dll")
then R crashes.
If I compile with the default flags (no ext...