home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / fortran / 4257 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  1.9 KB

  1. Path: sparky!uunet!hela.iti.org!usc!usc!not-for-mail
  2. From: olaf@alnitak.usc.edu (Olaf Meeuwissen)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Multiple includes
  5. Date: 10 Nov 1992 10:02:18 -0800
  6. Organization: University of Southern California, Los Angeles, CA
  7. Lines: 27
  8. Message-ID: <1dotfaINN4a1@alnitak.usc.edu>
  9. NNTP-Posting-Host: alnitak.usc.edu
  10.  
  11. Hello,
  12.  
  13. I have a question concerning include files.  Whenever I include a file twice in
  14. the same subroutine my compiler complains,  understandably.  However,  I really
  15. would like to do this.  Is there a way to include files conditionally?  I mean,
  16. only include it if it is not included already.
  17.  
  18. The reason  for this is  that I want to put all  the maximum dimensions for the
  19. arrays used in the program in one single file,  so the user knows where to find
  20. them if they have to be changed. Let's call this file `dim.h'. Now I have other
  21. header files, say `lib.h' and `sys.h', that both contain some arrays, so I want
  22. to include `dim.h'.  Then, if I have to include both `lib.h' and `sys.h' in one
  23. subroutine, yes, the compiler starts complaining!  Of course, I get similar re-
  24. sults if I want to include `dim.h' and any of the other header files.
  25.  
  26. For the moment I'm circumventing this by commenting out the include for `dim.h'
  27. in the other header files and explicitly including it in every subroutine,  but
  28. I find this highly inelegant.  Does someone have any suggestions on how to pro-
  29. gram a conditional include? They are more than welcome at olaf@alnitak.usc.edu.
  30.  
  31. Thanx,
  32.      ____               ___
  33.     / __ \ /\          / __\  Olaf Meeuwissen   (e-mail: olaf@alnitak.usc.edu)
  34.    / / / // /____    _/ /     Dept. of Chemistry, Univ. of Southern California
  35.   / / / // // __ \  /  _/     ------------------------------------------------
  36.  / /_/ // // /_/ /  / /       Predestination was doomed from the start.
  37.  \____//_/ \_____\ /_/                                                 -- N.N.
  38.