This example builds off the problem reported in https://software.intel.com/en-us/forums/topic/591342 (This problem is still there for this example)
The problem might also be related to the one reported at https://software.intel.com/en-us/forums/topic/543831 as it does basically the same thing except on windows.
Basically the example uses COMMON, EQUIVALENCE and calls a C function to assign a value for the variable using these intrinsics. I again build shared and static libraries (and shared and static modules). The output of the build and of the programs is in the file libex_withC_output.txt. One build fails as expected (see above). The value of the fortran variable (predef1) is correct when building a static library and using static modules. But the value of predef1 is not correct when building with a shared library.
Output of the programs:
C:\autotest\libex\build>bin\Release\main-shared.exe
x= 1
*** In C x= 1
predef1 0 0 <===== WRONG!
x= 3.000000
predef2 0 0
x,y= 3.000000 4.000000
x,y= 10 2
C:\autotest\libex\build>bin\Release\mainS-shared.exe
x= 1
*** In C x= 1
predef1 0 0 <===== WRONG!
x= 3.000000
predef2 0 0
x,y= 3.000000 4.000000
x,y= 10 2
C:\autotest\libex\build>bin\Release\mainS-static.exe
x= 1
*** In C x= 1
predef1 10 10 <===== RIGHT!
x= 3.000000
predef2 10 10
x,y= 3.000000 4.000000
x,y= 10 2
I've attached the entire build for this simple example which displays the issue, the actual source with the cmake build is in libex.
Again, any help would be appreciated.
Scot