The information in this article applies to:
SYMPTOMSAn attempt to link code that contains a COMMON block fails and the linker generates the following message: where <_XXXX> is the name of the COMMON block. CAUSEThe source code declares an initialized COMMON block with one size in one routine and an uninitialized COMMON block with the same name but with another size in another routine. RESOLUTIONThe best method to resolve this situation involves modifying the source code such that each declaration of the COMMON block has the same size. If this is not possible, modify the LINK command line to list the object module that contains the initialized COMMON block declaration before the other modules. In addition, the initialized COMMON block declaration must be as large or larger than any subsequent COMMON block declaration or memory corruption or other incorrect results may occur. STATUSThese problems do not occur with FORTRAN PowerStation 1.0a. MORE INFORMATIONThe Common Object File Format (COFF) implements COMMON blocks using two record types: COMDAT and COMDEF. A COMDAT record contains initialized COMMON block data and a COMDEF record contains uninitialized COMMON block data. LINK32 resolves each reference to the COMMON block by associating each COMDEF record with the first COMDAT record it encounters, if any. The first COMDAT record determines the amount of space reserved for the COMMON data storage; if no COMDAT record exists, the largest COMDEF record determines the amount of space reserved. This behavior has the following implications: If the data in a COMMON block is not initialized in any routine, COMMON block declarations with different sizes should not cause any problems and you can link the object files with the varying declarations in any order. Each declaration must be in a separate source file or the FORTRAN compiler generates an error.To demonstrate this error, perform the following four steps:
Sample Code 1
Sample Code 2
Sample Code 3
Additional query words: 1.00
Keywords : |
Last Reviewed: November 5, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |