home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4394 < prev    next >
Encoding:
Text File  |  1992-11-21  |  2.3 KB  |  43 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!milo.mcs.anl.gov!pepper.ra.anl.gov!froehle
  3. From: froehle@pepper.ra.anl.gov (P Froehle RE/207/xxx 4882)
  4. Subject: Re: Data initialization: FORTRAN program called as SUBROUTINE
  5. Message-ID: <72236599512731@pepper.ra.anl.gov>
  6. Sender: usenet@mcs.anl.gov
  7. Nntp-Posting-Host: pepper.ra.anl.gov
  8. Organization: Argonne National Laboratory, Argonne IL
  9. References: <1992Nov18.025912.13187@netcom.com>
  10. Date: Sat, 21 Nov 1992 17:13:15 GMT
  11. Lines: 30
  12.  
  13. In article <1992Nov18.025912.13187@netcom.com> jchauvin@netcom.com (John H. Chauvin) writes:
  14. >
  15. >I am currently working on a mix language program in which a C program 
  16. >calls a large FORTRAN program ( 15,000 lines , 100+ SUBROUTINES, 
  17. >and extensive use of COMMON blocks). I have converted the main routine 
  18. >from the FORTRAN into a SUBROUTINE and am calling the routine from 
  19. >the C code. I pass file information from the C program to the FORTRAN 
  20. >program using C data structures to FORTRAN common blocks. The 
  21. >general program flow is: C calls FORTRAN , waits, FORTRAN updates C, 
  22. >FORTRAN returns to C, C calls FORTRAN ,etc.. The C and FORTRAN 
  23. >routines are linked into one large binary program. All FORTRAN variables 
  24. >required SAVE status. The main advantage to the above approach is the 
  25. >ease to which I can exchange data between the C (graphics front end) and 
  26. >the FORTRAN (number crunchier).
  27. >
  28. >Everything works great until I try and call the FORTRAN a second time. 
  29. >The variables and COMMON blocks still retain values from the first call. 
  30. >(Not surprisingly) How can I reinitialize all the COMMON blocks and 
  31. >variables to the state that existed at the beginning of the first call?  
  32. >Normally the FORTRAN would be executed as a stand alone program 
  33. >from the command line , loaded into memory and the variables initialized 
  34. >each time it is used. This is the behavior I want to achieve with each call to 
  35. >the FORTRAN. Initializing all the variables myself is out of the questions 
  36. >because of the size of the code and the fact that all the variables have 
  37. >been SAVEd. Is there a way to do this?  Any help or suggestions would be 
  38. >GREATLY appreciated.
  39. >
  40. Another way is to pass the data in a file and have the c program spawn
  41. the fortran program.  That way the fortran program initializes each time.
  42. ..paul ... phfroehle@anl.gov
  43.