millward@m... wrote:
> Can anyone tell me how to call a FORTRAN
> routine from within a Linux GNU C program?
You can use f2c, which converts to c code first. As I recall, it works
something like
# f2c -P file.f
# gcc file.c -c
and to call within C, use
#include<f2c.h>
#include"file.P"
and compile
# gcc cfile.c file.o -lf2c -lm
file.P tells you the function arguments, which are not what you expect.
There may be other ways to link, for example, g77 object files to C
code, but in any case, you'll need some way of mapping function
arguments and FORTRAN often has hidden arguments.
> FORTRAN is better for calculations than
> C and I'd like to mixed the two and see
> if performance is better than with just
> plain C.
I'm not convinced. In any case, you can develop C++ code faster than
fortran, and very seldom is runtime more valuable than development time.
If you just want scientific routines, try the GNU Scientific Library (in C).
--
JDL