Skip to content
Prev 16623 / 63424 Next

Calling C from Fortran

Thanks for your reply.

Am I write if I say that the wrapper shoul be 
double F77_SUB(mygammafn)(double *x) { return gammafn(*x); }

instead of 
double F77_SUB(mygammafn)(double *x) { return gammafn(x); }

the first does not compile.
wrapper2.c: In function `mygammafn_':
wrapper2.c:6: error: incompatible type for argument 1 of `Rf_gammafn'

The second compiles and works fine.


But still,  I find it very strange as the C function gammafn actually called 
( as I can see from /R-2.1.0/src/nmath/gamma.c)
is not defined as
double gammafn(double *x)

but as
double gammafn(double x)

Am I missing something ?

Gilles 


Le Mercredi 15 Juin 2005 17:06, vous avez ?crit :