Microsoft KB Archive/112334

From BetaArchive Wiki

Article ID: 112334

Article Last Modified on 12/1/2003



APPLIES TO

  • Microsoft FORTRAN PowerStation 1.0 Standard Edition
  • Microsoft Fortran PowerStation 1.0a for MS-DOS
  • Microsoft FORTRAN PowerStation 32
  • Microsoft FORTRAN PowerStation 32



This article was previously published under Q112334

SUMMARY

The 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 symbol


In Microsoft FORTRAN PowerStation, the error generated by the linker is LNK4516.

MORE INFORMATION

When 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.for
                

To 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.for
                

To generate LNK4016, build A.FOR, B.FOR, and either C.FOR or D.FOR:

   fl32 a.for b.for d.for
                

To create a working program that uses both definitions of "TEST", build all four files together:

   fl32 a.for b.for c.for d.for
                

Note 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 Test


No 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 query words: kbinf 1.00 4.00

Keywords: kberrmsg KB112334