Software Archive
Read-only legacy content
17061 Discussions

Common Block/Shareable Images

Intel_C_Intel
Employee
517 Views
I have a common block that contains pointers to P2 space structures. Routine umap in shareable image #1 maps and loads all the pointer values. Routine uload in shareable image #2 loads and processes that data. From a user program that is linked with both shareable images I call umap and uload. If my main program includes the common block and then calls umap, upon return the pointer values are set. However, when I call uload, uload doesn't know about them. Am I missing a FORTRAN and/or LINKER option when doing this? Is it possible to do this?
0 Kudos
3 Replies
Steven_L_Intel1
Employee
517 Views
To make this work, all three images need to agree on where the common block is defined. My preference for this sort of thing is to separate out the common into a BLOCK DATA subprogram and link that as its own shareable image. Then you would link the two other shareable images to the one with the common. I think that umap isn't linking against a shareable image that defines the common.

Be sure that you have set up your linker options file to specify the PSECT_ATTR directive that makes the common block "export" from the shareable image (and you have to change the NOSHR attribute to SHR throughout. See the Fortran for OpenVMS User Manual for details.

Steve
0 Kudos
Intel_C_Intel
Employee
517 Views
Finally found it. If I add shareable image #1 to the linker option file for shareable image #2, the symbols will be available.
0 Kudos
Steven_L_Intel1
Employee
517 Views
Right - #2 needs to link against #1 (or they both need to link against a "#0") to all see the same memory.

Steve
0 Kudos
Reply