Knowledge Base

FIX: Access Violation on READ of Exported COMMON Array

PSS ID Number: 112010

Article Last Modified on 5/4/2001


The information in this article applies to:


This article was previously published under Q112010

SYMPTOMS

Attempting to READ an array element that is exported from a COMMON block in a dynamic-link library (DLL) may generate an access violation message box under Windows NT.

CAUSE

This run-time error occurs when the data is read from an external file. This error does not occur with WRITE statements or when reading COMMON variables.

RESOLUTION

READ exported COMMON data into local allocatable arrays, and then assign these arrays to the arrays in the exported COMMON block.

STATUS

Microsoft has confirmed this to be a problem in FORTRAN PowerStation for Windows NT, version 1.0. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The sample below illustrates the problem:

Sample Code

c MAIN Source Code
c Compile options required: none
c Linker options required: include the import library for the DLL.
c

      interface to subroutine bar[dllimport]()
      end
      common /bridge[dllimport]/ i
      integer*4 i(4)
      open(3,file='main.inp')
      read(3,*) i(1)
      close(3)
      call bar
      end
c DLL Source Code
c Compile options required: /LD
c

      subroutine bar[dllexport]()
      common /bridge[dllexport]/ i
      integer*4 i(4)
      write(*,*) 'In DLL:'
      return
      end
Contents of main.inp:
1
				

Additional query words: 1.00 Dr. Watson imported buglist1.00

Keywords: kbbug KB112010
Technology: kbAudDeveloper kbFORTRANPower32100NT kbFortranSearch kbZNotKeyword2