Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Naming Module shared data section to exclude sharing unshared data

MWind2
New Contributor III
347 Views

In MSVC there is the

#pragma data_seg("sdata")
//....
#pragma data_seg()
#pragma comment(linker, "/Section:sdata,RWS") 

that lets you only share that data section and only that section in a dll. I was trying the module example in   DLL_Shared_Data with the module data being in ".data" with /section:.data,RWS. In my anticipated code, there would be unshared data in it as well, and I was worried how to keep separate as that private data may be put in ".data".   

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
347 Views

I don't think there's a way to do this in Intel Fortran. However, my usual advice for sharing data cross-process in a DLL (that's what the linker directive is for) is to put the data you want shared in its own module and build that module into a DLL. Have other code that wants to use that shared data link to that DLL.

View solution in original post

0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
348 Views

I don't think there's a way to do this in Intel Fortran. However, my usual advice for sharing data cross-process in a DLL (that's what the linker directive is for) is to put the data you want shared in its own module and build that module into a DLL. Have other code that wants to use that shared data link to that DLL.

0 Kudos
MWind2
New Contributor III
347 Views

So if I had to use fortran for such, I would need two dll's one private and  one shared data?

0 Kudos
Steve_Lionel
Honored Contributor III
347 Views

Yes, I suppose that is true.

0 Kudos
Reply