[comp.lang.fortran] C subroutines in FORTRAN programs

craig@fractal.eng.buffalo.edu (Craig Steinberger) (02/28/90)

Has anyone have any experience in using C system subroutines in FORTRAN? 
What I am trying to do is use the clock(3) routine in order to time an 
algorithm, but I don't know how to do it. (Yes I know I can use prof, but
that isn't adequate for various reasons. ) I am using a Sun 4/150 running
SunOs 4.0.3

Thanks
-Craig
-----
Transcendentalism is all very fine,  |  Craig Steinberger
but how does that relate to what     |  SUNY at Buffalo, Aerospace Engineering
You see in the subway?               |  craig@fractal.eng.Buffalo.edu

craig@acsu.Buffalo.EDU (Craig Steinberger) (02/28/90)

Robert Howard was kind enough to show me how to use a C subroutine in a
FORTRAN program (see my earlier question). To do this, one must write
a C program to "drive" the subroutine. For example, if I wanted to use
the clock() C routine, I would write a C program as follows:

timer_() {
return(clock());}

(The key is to put an underscore after the C routine name)

I would then call this from the FORTRAN program like a FORTRAN 
function. 


Transcendentalism is all very fine,  |  Craig Steinberger
but how does that relate to what     |  SUNY at Buffalo, Aerospace Engineering
You see in the subway?               |  craig@fractal.eng.Buffalo.edu