For this particular project, I have created A.dll, B.dll, and C.exe.
A.dll does a whole lot of calculations, and keeps the numbers in COMMON blocks. Given the sheer number of variables and COMMON blocks, I have attempted to export them like so in a single subroutine:
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
COMMON /FUN2 / CFUN2 ( 76)
!DIR$ ATTRIBUTES DLLEXPORT :: /FUN2/
C.exe will load A.dll, direct A.dll to initialize itself, and populate the variables in the COMMON blocks. So far so good! But now, C.exe loads B.dll, and calls one special subroutine in B.dll. Now, B.dll contains this:
SUBROUTINE Special()
!DIR$ ATTRIBUTES DLLIMPORT :: /FUN2/
DOUBLE PRECISION C1, C2, C3, ...
COMMON/FUN2/C1, C2, C3(2,11), ...
But unfortunately, once I step into Special(), the value of C1 is equal to 0. If I'm in A.dll, the value of C1 is non-zero. So, I have the impression that I messed up somewhere in sharing the data in the COMMON blocks between A.dll and B.dll. Any idea what I'm doing wrong?