Microsoft KB Archive/108410

= FIX: Entire DLLEXPORTed Arrays Cannot Be Written Implicitly =

PSS ID Number: 108410

Article Last Modified on 3/24/2000

-

The information in this article applies to:


 * Microsoft Fortran Powerstation 32 for Windows NT 1.0

-



This article was previously published under Q108410



SYMPTOMS
An attempt to print out an array that is exported from a common block in a dynamic-link library (DLL) may produce incorrect values when the entire array is printed at once (by giving only the array name in the I/O statement or by using an implied do loop).

This problem occurs when writing to all types of files and to the display.



RESOLUTION
Use an implied do loop and add 0 (zero) to the array index, or write the array elements individually.



STATUS
Microsoft has confirmed this to be a problem in Microsoft FORTRAN PowerStation 32 for Windows NT, version 1.0. This problem was fixed in FORTRAN PowerStation, version 4.0.



MORE INFORMATION
The following sample code illustrates this problem:

Sample Code #1
C Compile options needed: none

C FORTRAN Main Source:

interface to subroutine bar[dllimport] end common /bridge[dllimport]/ i     integer*4 i(4) i(2) = 2

write(*,*) 'In Main: i = ', i     do loop=1,4 write(*,*) 'In main: i = ', i(loop) end do

write(*,*) 'Calling DLL routine...' call bar c The commented line below illustrates the suggested workaround: c    write(*,*) 'In Main: i = ', (i(loop+0),loop=1,4) write(*,*) 'In Main: i = ', (i(loop), loop=1,4) do loop=1,4 write(*,*) 'In main: i = ', i(loop) end do     end

Sample Code #2
C FORTRAN DLL Source:

subroutine bar[dllexport] common /bridge[dllexport]/ i     integer*4 i(4) i(3) = 33 write(*,*) 'In DLL: i = ', i      return end

Program Output (corrected for CR/LF anomalies)
In Main: i =  550774271   637468674      139472 -1869574000 In main: i =          0 In main: i =          2 In main: i =          0 In main: i =          0 Calling DLL routine... In DLL: i =           0           2          33           0 In Main: i =  550774271   637468674      139472 -1869574000 In main: i =          0 In main: i =          2 In main: i =         33 In main: i =          0

Additional query words: 1.00

Keywords: kbbug KB108410

Technology: kbAudDeveloper kbFORTRANPower32100NT kbFortranSearch kbZNotKeyword2

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.