Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Share COMMON BLOCK between EXE and 2 DLL's.

$
0
0

I have an old DLL (source code is lost) created with Compaq Visual Fortran that exports a common block.  I'm trying to add another DLL to the project that uses the same common block .  The main executable and DLL are developed with Intel Visual Fortran.  The program works fine if either one of the DLL's are added to the project, but fails with the IVF DLL (common block data not passed) if both DLL's are included.  Here are the code snippits:

      SUBROUTINE DLL1     ! Old DLL built with CVF or DVF
!DEC$ATTRIBUTES DLLEXPORT :: DLL1, NBR, TXT
      SUBROUTINE DLL2     ! New DLL built with IVF
!DEC$ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE :: DLL2
!DEC$ATTRIBUTES DECORATE, ALIAS:'DLL2' :: DLL2
!DEC$ATTRIBUTES DLLEXPORT :: /NBR/    ! Also tried DLLIMPORT linking against DLL1 .lib
!DEC$ATTRIBUTES DLLEXPORT :: /TXT/    ! Also tried DLLIMPORT linking against DLL1 .lib
      PROGRAM MAIN        ! Built with IVF
!DEC$ATTRIBUTES DLLIMPORT,STDCALL,REFERENCE,ALIAS:'_DLL1@0' :: DLL1
!DEC$ATTRIBUTES DLLIMPORT,STDCALL,REFERENCE,ALIAS:'_DLL2@0' :: DLL2
!DEC$ATTRIBUTES DLLIMPORT :: /NBR/
!DEC$ATTRIBUTES DLLIMPORT :: /TXT/
      CALL DLL1    ! Works OK
      CALL DLL2    ! Only works if DLL1 not imported


! The calling exe and both DLL's include the following:
      REAL*4       V1, V2
      COMMON/NBR/  V1(50),V2(75)
      CHARACTER*20 S1,S2
      COMMON/TXT/  S1,S2

Any suggestions or ideas what I'm doing wrong?


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>