C + FORTRAN + getenv() (Was: NCAR running under AIX 3.1 update 3003)
Gary Kakazu
kakazu at theory.tn.cornell.edu
Thu Apr 18 05:25:57 AEST 1991
Last week I asked about running NCARG under AIX 3.1 update 3003. I
heard that there were some troubles running ncarg under 3003. Some
of the responses I got said that it would run, and some said wouldn't.
I decided to try it myself and found the following problem.
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.
If you just have a C program that calls getenv, it works fine.
I have written an example of a C & Fortran program that illustrates
the problem. If anyone knows of a way around this, let me know.
Thanks.
----------The Makefile-----------------
COBJS = test1.o
FOBJS = test1f.o
FFLAGS = -g
test1: $(COBJS) $(FOBJS)
xlf $(FFLAGS) -o test1 $(COBJS) $(FOBJS)
--------Call me test1f.f---------------------
call c_routine( )
stop
end
--------Call me test1.c-----------------
c_routine( )
{
char *ptr;
printf("Before getenv\n");
ptr = getenv( "PWD" );
printf("ptr is: %s\n",ptr);
}
More information about the Comp.unix.aix
mailing list