USING FORTRAN/IMSL LIB. FROM C

Kenneth L Moore yahoo at unix.cis.pitt.edu
Sun Feb 18 07:40:26 AEST 1990


In article <1990Feb16.172952.24266 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>In article <Feb.15.22.58.45.1990.11984 at amalthea.rutgers.edu> majmudar at amalthea.rutgers.edu (Keyur Majmudar) writes:
=>=>I am trying to call an IMSL subroutine (qdags) [in FORTRAN] from a C

=>You need to look in your Fortran manual to find out the details of linking
=>Fortran to C on your particular system.  
=>Also, parameter-passing conventions are often different.  You
=>usually can't just call Fortran subroutines as if they were C functions.

I'll add an amen to that. When I was writing my master's thesis I had to
call FORTRAN functions from a C program because of complex number
manipulation (on our machine the FORTRAN intrinsic complex number
arithmetic was much faster than using C routines). I had to read our
system's manuals to be successful.

I could not just call FORTRAN functions as if they were written in C.
Especially if they had character strings, which require a string length
in FORTRAN passes.

I also had to set special loader flags to get it to work.

However, after the initial effort, the result was flawless. So don't be
discouraged. It only took me two days to get it working. (and I'm not
all that swift!)

-- 
I don't yell and I don't tell and I'm grateful as hell: Benny Hill



More information about the Comp.lang.c mailing list