C + FORTRAN + getenv() (Was: NCAR running under AIX 3.1 update 3003)
Scott Holt
scott at prism.gatech.EDU
Thu Apr 18 07:01:28 AEST 1991
In article <1991Apr17.192557.5133 at batcomputer.tn.cornell.edu> kakazu at theory.tn.cornell.edu (Gary Kakazu) writes:
>
>It appears that if a Fortran program calls a C program, and the C
>program calls the routine getenv, the program crashes. If I comment
>out getenv in the routines that call it, and pass the GRAPHCAP & FONTCAP
>info on the command line, the example program works fine.
>
You are essentially correct - there is a problem. However, it is possible to
mix FORTRAN and C with a C routine that calls getenv - just make sure you
link in the C runtime library... as in:
test1: $(COBJS) $(FOBJS)
xlf $(FFLAGS) -o test1 $(COBJS) $(FOBJS) -lc
Ordinarily the linker will satisfy the reference to getenv from the FORTRAN
runtime library.
Now, there is a problem if BOTH the FORTRAN and C routines call their
respective getenvs - There can only be one getenv symbol in the final
bound product so someone looses.
-Scott
--
This is my signature. There are many like it, but this one is mine.
Scott Holt Internet: scott at prism.gatech.edu
Georgia Tech UUCP: ..!gatech!prism!scott
Office of Information Technology, Technical Services
More information about the Comp.unix.aix
mailing list