Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!apple!agate!violet.berkeley.edu!jerry From: jerry@violet.berkeley.edu (Jerry Berkman) Newsgroups: comp.lang.fortran Subject: Re: archiving block data subroutines... Message-ID: <1990Nov22.074157.15813@agate.berkeley.edu> Date: 22 Nov 90 07:41:57 GMT References: <27320@shamash.cdc.com> Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: University of California, Berkeley Lines: 34 In article burley@world.std.com (James C Burley) writes: ... ==All readers should note that the Fortran standards, both 77 AND 90, DISALLOW ==initialization (via DATA or, for 90, via initial values specified on type- ==declaration statements) of entities in common blocks except within BLOCK ==DATA subprograms, and there only for named common blocks (i.e. you can't ==provide initial values for entities in blank common). In other words, the ==following very effective solution is, unfortunately, nonstandard, even though ==I believe it will work on every single machine that supports Fortran to any ==reasonable extent (i.e. here's a recommendation, though it isn't standard): == SUBROUTINE DOES_NOTHING !Instead of BLOCK DATA DOES_NOTHING. == INTEGER NOTHING == COMMON /NOTHING/ NOTHING == ...other stuff you want to put in a BLOCK DATA... == DATA NOTHING/0/ !Make sure it isn't 12345. == ...other DATA statements you'd put in a BLOCK DATA... == END ==... the above solution will work on any system I can imagine, as long as ==it accepts the nearly ubiquitous extension allowing DATA for variables in ==common from within subroutines or functions. ==James Craig Burley, Software Craftsperson burley@world.std.com This is flagged as an error by VS FORTRAN which is IBM's mainframe FORTRAN compiler. Also by WATFOR77 on our IBM mainframe. There is probably no easy way which works on all systems to get block data's to load. Some UNIX systems will load a block data in a library if it is in the same source file as another program segment being loaded, some UNIX systems will not. All the non-UNIX systems I have used would not. - Jerry Berkman, U.C. Berkeley, jerry@violet.berkeley.edu