Hollerith Constants in Argument ListsLast reviewed: December 9, 1995Article ID: Q112334 |
The information in this article applies to:
SUMMARYThe use of Hollerith constants outside of a FORMAT specifier is not part of the FORTRAN 77 specification. Any use of Hollerith constants in an argument list is undocumented and unsupported. Using Hollerith can cause the following compiler and linker errors:
F2202: defined with different number of arguments F2608: Hollerith illegal with CHARACTER F2624: too few actual arguments LNK4016: unresolved external symbolIn Microsoft FORTRAN PowerStation, the error generated by the linker is LNK4516.
MORE INFORMATIONWhen Hollerith constants are used in the argument list of a function or subroutine call, the size of the string is not passed. To the compiler, this looks like references to a function or subroutine with one of the arguments missing. To the linker, this looks like a reference to a different function or subroutine. To generate the F2202 error, combine B.FOR and D.FOR into one file and compile it:
copy b.for+d.for test.for fl32 /c test.forTo generate the F2608 and F2624 errors, combine A.FOR and B.FOR into one file and compile it:
copy a.for+b.for test.for fl32 /c test.forTo generate LNK4016, build A.FOR, B.FOR, and either C.FOR or D.FOR:
fl32 a.for b.for d.forTo create a working program that uses both definitions of "TEST", build all four files together:
fl32 a.for b.for c.for d.forNote that this produces a LNK4006 warning that refers to the undecorated symbol "_TEST". This name is not used by the program, and therefore the warning can be ignored. Executing A.EXE produces:
Test Quoted: Big Test Test Hollerith: Big TestNo specific compiler options are required for any of the samples.
Sample Code A.FOR
call test('Big Test') call test_hollerith() end Sample Code B.FOR
subroutine test_hollerith() call test(8HBig Test) end Sample Code C.FOR
subroutine test(x) real*8 x write(*,"(' Test Hollerith: ',A8)") x end Sample Code D.FOR
subroutine test(c) character*8 c write(*,"(' Test Quoted: ',A8)") c end |
Additional reference words: kbinf 1.00 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |