Path: utzoo!attcan!uunet!decwrl!shelby!portia.stanford.edu!news From: volovich@dendrite.Stanford.EDU (Gene Volovich) Newsgroups: comp.lang.fortran Subject: Calling a C function from Fortran. Message-ID: <1990Aug2.191231.11783@portia.Stanford.EDU> Date: 2 Aug 90 19:12:31 GMT Sender: news@portia.Stanford.EDU (USENET News System) Organization: Stanford University Lines: 26 I'm calling a C function from a FORTRAN program on an RT running AOS, and using the standard C compiler and f77. I actually got this to run, but my question is this: why does there need to be an underscore after the name of the C function I'm calling? Here's my code: Fortran code: ... I=VISIT(J) ... C code: int visit_(k) int *k; { printf("%d \n",*k); return (*k+1); } I compiled the FORTRAN code, and the C code, and then used f77 to link them into an executable file. I've never heard of anyone having this problem, so it all seems very strange to me. Thanks, and I hope I'm not wasting bandwidth with a trivial problem. +------------------------------------------- - Gene Volovich | "We are the music makers. Academic Information Resources | We are the dreamers of dreams." Stanford University | - Willy Wonka ***************************************************************************