We are looking to port some vms fortran to linux using ifort. We use global commons on vms side in the standard way (use a BLOCK DATA fortran program, then link it using an .OPT file with
We then install the common
INSTALL> replace TEST_COMMON/SHARED/OPEN/WRITE
I cannot find an example of the equivalent to this idea using linux and ifort. Any help would be appreciated (like a link to a simple example would be swell). Thank you
I don't have a complete answer for you here, other than to note that Linux doesn't have the equivalent of VMS INSTALL (at least not for this purpose.)
The general concept is that you would link the COMMON into a shared object (.so) using the -shared option on the link (ld) command. However, the default, as on VMS, is that data sections in shared objects are NOT shared across users - each program that loads the shared object gets its own copy of the data.
I know how to do what you want on Windows ( link the DLL with /section and the RWS option) but my Google-fu is failing for Linux. Perhaps other users here will know the correct incantation.
If you don't mind a bit of effort, you might find that the mmap library call can be used to accomplish the data sharing. Since Intel Fortran has features for pointers (either the integer pointer extension (aka "Cray pointers") or the Fortran standard C_PTR type and functions for dealing with them in ISO_C_BINDING) you could replace the COMMON variables with POINTERs in a module and use mmap at program startup to locate the shared data and map it into memory with the address saved in the pointer.