Help: Invalid declaration while calling C function

From: SeanYang (yang22_at_ecn.purdue.edu)
Date: 03/17/05


Date: Thu, 17 Mar 2005 12:14:47 -0500
To: Sean Yang <Unknow@purdue.edu>


I wanted to call a C function from my Fortran program, but I got an
"Invalid declaration of or reference to symbol" error message as follows
when I compile it. Here is my source code, thank you for help.

>gcc -c myc_func.c
>f77 mytestf.f myc_func.o -o mytestf
mytestf.f: In program 'test.f':
mytestf.f:6
        K=myc_func()
Invalid declaration of or reference to symbol 'myc_func'



int myc_func_(){
  int value=0;
  return value;
}



      program testf
      
      implicit none
      INTEGER N, K
      N=10
      K=myc_func()
      WRITE(*,30) K
  30 FORMAT('The current value is',I16)
      CALL EXIT
      END