BUG: Block-Data Subprograms Are Not Global SymbolsLast reviewed: July 13, 1995Article ID: Q118432 |
The information in this article applies to:
SYMPTOMSWhen an object module containing only a block-data subprogram is placed in a library and that library is used to link to an executable file, the block-data subprogram is not linked to the executable file: no data initialization is performed. According to the ANSI specification for FORTRAN 77, it is possible for a program to include a block-data module by making an external reference to the block-data subprogram.
CAUSEThe linker links modules from a library only when the modules each contain a global symbol that matches an external reference to a procedure. Because a block-data module contains no global procedure names, the linker cannot be made to link the block-data module to the executable file.
RESOLUTIONIn order to work around the problem, do one of the following:
STATUSMicrosoft has confirmed this to be a bug in the FORTRAN PowerStation for MS- DOS, versions 1.0 and 1.0a, and the FORTRAN PowerStation 32 for Windows NT, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONTo demonstrate the problem and both workarounds, perform the following steps:
Sample Code 1c compile options needed: none
common /block_com/ y print *,yC The following statement causes an external reference to "block_data", C even though the call will never be made. A block-data subprogram will C automatically execute before the first statement in a program if it is C in the executable file. if (.false.) call block_data() end Sample Code 2c compile options needed: none
block data block_data common /block_com/ x data x /3.1415/ end Sample Code 3c compile options needed: none
subroutine block_data() end block data block_data2 common /block_com/ x data x /3.1415/ end |
Additional reference words: 1.00 1.00a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |