home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!jchauvin
- From: jchauvin@netcom.com (John H. Chauvin)
- Subject: Data initialization: FORTRAN program called as SUBROUTINE
- Message-ID: <1992Nov18.025912.13187@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Wed, 18 Nov 1992 02:59:12 GMT
- Lines: 40
-
-
- I am currently working on a mix language program in which a C program
- calls a large FORTRAN program ( 15,000 lines , 100+ SUBROUTINES,
- and extensive use of COMMON blocks). I have converted the main routine
- from the FORTRAN into a SUBROUTINE and am calling the routine from
- the C code. I pass file information from the C program to the FORTRAN
- program using C data structures to FORTRAN common blocks. The
- general program flow is: C calls FORTRAN , waits, FORTRAN updates C,
- FORTRAN returns to C, C calls FORTRAN ,etc.. The C and FORTRAN
- routines are linked into one large binary program. All FORTRAN variables
- required SAVE status. The main advantage to the above approach is the
- ease to which I can exchange data between the C (graphics front end) and
- the FORTRAN (number crunchier).
-
- Everything works great until I try and call the FORTRAN a second time.
- The variables and COMMON blocks still retain values from the first call.
- (Not surprisingly) How can I reinitialize all the COMMON blocks and
- variables to the state that existed at the beginning of the first call?
- Normally the FORTRAN would be executed as a stand alone program
- from the command line , loaded into memory and the variables initialized
- each time it is used. This is the behavior I want to achieve with each call to
- the FORTRAN. Initializing all the variables myself is out of the questions
- because of the size of the code and the fact that all the variables have
- been SAVEd. Is there a way to do this? Any help or suggestions would be
- GREATLY appreciated.
-
-
- Thanks
-
- jchauvin@netcom.com
-
- -------------------------- Configuration Information -------------------------------------
- Workstation: Silicon Graphics Crimson Elan with 64 mb RAM
- Operating System IRIX 4.0.5A (AT&T UNIX with Berkeley extensions)
- Development Options.....v4.1
- FORTRAN & C Compilers v3.10
- --------------------------------------------------------------------------------------------------
- --
- John H. Chauvin jchauvin@netcom.COM
- Netcom - Online Communication Services San Jose, CA
-