Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Sharing data in DLLs

Phares__Cliff
Beginner
913 Views

I have a process model programmed in Fortran on a MicroVAX. It utilizes an installed, shared common to share data between many applications. I would like to move this process model to a server and am having difficulty with the shared data concept.

let's say the shared data area contains an integer(4), N.

let's say I want a Fortran console app(peekN)which printsN to screen.

let's say I want another Fortran console app (pokeN)which increments N by 1.

I want to run peekN from the command promptand see the default init value of N.

I want to run pokeN from the command prompt and modify that value of N.

I then want to run peekN from the command prompt to see the new value of N.

I don't know the PC analog of 'install', but it seems like the shared data DLL isn't installed.

What am I doing wrong ?

thanks for any help or references,

Cliff Phares

(409)886-9573

0 Kudos
4 Replies
Steven_L_Intel1
Employee
913 Views
There is no equivalent of the VMS "installing a shared library". The bit you are missing is that when you link the DLL, you have to add the linker option:

/section:.data,RWS

If you don't do this, then each process gets its own copy of the shared data (it is shared within the process, just like in VMS when you don't INSTALL the shared library.)

In Visual Studio, you add this on the Linker > Command Line property page.

In version 10, the supplied sample program DLLDLL_Shared_Data demonstrates this.
0 Kudos
Phares__Cliff
Beginner
913 Views

Thanks Steve;

I'm not quite sure what the /section:.data,RWS switch does when I compile the shared data DLL. How does the data stay resident in memory ? Do I need to create a program which remains linked to the shared data DLLto keep shared datain memory ? Is this the work-around to the VMS install utility ?

What is the least resource demanding way of keeping an executable running ? VMS had the SYS$HIBER and SYS$WAKEUP. VMS also had AST timers to generate interrupts.

I tried to install V10 once awhile back and it didn't go well. I haven't tried it since.

Any help is greatly appreciated.

Thanks,

Cliff

(409)886-9573

0 Kudos
Steven_L_Intel1
Employee
913 Views
If I recall correctly, the updated data is not written back to the DLL so that once all programs using the DLL have exited, the updated data is lost. You can certainly create a process that stays around, but another solution more "Windows-y" would be to use file mapping (something like VMS global sections). This would be done with Win32 API routines such as CreateFileMapping and MapViewOfFile with the FILE_MAP_WRITE access option. This would get you the address of the mapped storage with which you can use a pointer to associate it with an array. (The integer pointer extension would work for this.)

What problem did you have with version 10? Did you contact Intel Premier Support about it?
0 Kudos
Phares__Cliff
Beginner
913 Views

I've seen the same problem mentioned since in your Forum. I've contacted Support - they recognized it as a problem. I wasn't the only one to report it.

There were two problems. The 1st was creating a new DLL. I made a forum entry to which you replied 'contact Support'.

The 2nd issue was with removing the software. Not all components and registry entries were taken care of when un-installing. Support had a work-around for that as well.

I'm just going to wait for 10.1 or 10.2 .

Thanks for all your help.

- Cliff

0 Kudos
Reply