Newsgroups: comp.unix.aix Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!theory.tn.cornell.edu!kakazu From: kakazu@theory.tn.cornell.edu (Gary Kakazu) Subject: C + FORTRAN + getenv() (Was: NCAR running under AIX 3.1 update 3003) Message-ID: <1991Apr17.192557.5133@batcomputer.tn.cornell.edu> Originator: kakazu@theory.tn.cornell.edu Sender: news@batcomputer.tn.cornell.edu Nntp-Posting-Host: theory.tn.cornell.edu Organization: Cornell Theory Center Date: Wed, 17 Apr 1991 19:25:57 GMT 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); }