How to call a C-routine from Fortran
There is usually not major problem to call C-routines
from C and vice-versa
(as long as the parameters are arrays and scalars). This is the way to
use
fsecond
.
program examp
double precision :: fsecond, t
t = fsecond()
! compute ...
t = fsecond() - t
print*, 'time = ', t
end program examp
and this is how you compile and link:
fsecond.c
once and for all using the
C-compiler:cc -c fsecond.c
this will produce
the object file fsecond.o
fc my_prog.f90 fsecond.o