C This software IMEXPORT.FOR is part of the Compaq Visual Fortran kit.
C
C This software is provided as an example that demonstrates a particular
C feature/function of the licensed product. The software is not intended to
C provide a complete solution to any application problem but rather is provided
C as a teaching mechanism.
C
C Users may incorporate any part of this sample into their own source after 
C making appropriate changes to make it suitable for the intended application.
C
C This example contains a main program and two dynamic link libraries.
C Each of the dynamic link libraries uses "cDEC$ ATTRIBUTES DLLEXPORT::"
C to make a COMMON block visible to applications and DLLs which link 
C against it.  The main program uses "cDEC$ ATTRIBUTES DLLIMPORT::" to
C access the 2 COMMON blocks.  Each of the DLLs uses 
C "cDEC$ ATTRIBUTES DLLIMPORT::" to access the common block of the other.
C
C
      PROGRAM IMEXPORT

cDEC$ ATTRIBUTES DLLIMPORT:: /DLL1_COMMON/, /DLL2_COMMON/ 

      COMMON /DLL1_COMMON/ DLL1_DATA
      COMMON /DLL2_COMMON/ DLL2_DATA

      REAL DLL1_DATA, DLL2_DATA

      DLL1_DATA = 1.0
      DLL2_DATA = 1.0
      
      CALL MAIN_SUB
      CALL DLL1_SUB
      CALL DLL2_SUB

      END

      SUBROUTINE MAIN_SUB
cDEC$ ATTRIBUTES DLLIMPORT:: /DLL1_COMMON/, /DLL2_COMMON/ 
      COMMON /DLL1_COMMON/ DLL1_DATA
      COMMON /DLL2_COMMON/ DLL2_DATA

      REAL DLL1_DATA, DLL2_DATA

      DLL1_DATA = DLL1_DATA + 1
      DLL2_DATA = DLL2_DATA + 1

      WRITE (6,*) 'In MAIN_SUB, values are: ', DLL1_DATA, DLL2_DATA

      END
