Hello,
I am currently working on a project where we have to port 64-bit Fortran/C code from Linux to Windows. We have chosen the Intel Fortran compiler for Windows because we had a very good experience when we used it to port from SGI to Linux. I was pleasantly surprised to see that the Intel compiler gives access to Win32 subroutines for semaphores, mapped files, etc.
My current issue is how to implement shared memory used to communicate between different processes. In Linux, we do the following:
- We declare variables and assign pointers to them. Example integer*4 var1(100), var2(100), var3(200),.... pointer(var1_p,var1) pointer(var2_p, var2), pointer(var3_p, var3),...
- After we know how much memory space we are going to need (by using the size of the variables and arrays), we call shmget and shmat. If we are successful, we get back the address at which our share memory was set, i.e. myaddress
- Once we know the start address of our shared memory (myaddress), we map our pointers: var1_p = iand((myaddress+7),0xFFFFFFFFF8), var2_p = iand((var1_p+4*100+7),0xFFFFFFFF8), var3_p = iand((var2_p+4*100+7),0xFFFFFFFF8), etc
- Then, we can access var1, var2, var3, etc directly without the need for an offset.
My question is if anybody knows if we can do something similar when we use OpenFileMapping, MapViewOfFile, etc in Windows or do we have to redesign our approach. This is one big concern I have. I do not how to setup the memory mapped file such that I can access variables independently like we do with our approach in Linux.
Any comment would really be appreciated.
Thanks,
Aldo L.