This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Segmentation fault calling fortran function from c
- From: asilter79 <asilter79 at hotmail dot com>
- To: fortran at gcc dot gnu dot org
- Date: Wed, 4 Jul 2007 07:32:30 -0700 (PDT)
- Subject: Segmentation fault calling fortran function from c
hi,
all i want to do is sending an integer variable from c program to fortran
function. And I want fortran function to return it back to c program. But it
fails as "Segmentation fault". Here's the code.
call_fortran.c
-----------------------
#include <stdio.h>
int main(int argc, char * argv[])
{
int a = 4;
int b = 0;
b = intgerigonder_(a);
printf("Integer which has come back here again=%d\n\n",b);
return 0;
}
Grades.F
----------------------------
c
c Grades
c
integer Function INTGERIGONDER (X)
integer X
write(*,300) 'Im sending C the integer value it has sent to me.'
300 format(A)
INTGERIGONDER=X
Return
End
-------------------------
in the fortran function, when assigning X value to INTGERIGONDER , it gives
the "SEGMENTATION FAULT" error.
why?
plz help,thanx.
--
View this message in context: http://www.nabble.com/Segmentation-fault-calling-fortran-function-from-c-tf4024692.html#a11431780
Sent from the gcc - fortran mailing list archive at Nabble.com.