Hi, Im trying to get a C++ and Fortran program to send each other data. I have used the http://msdn.microsoft.com/en-us/library/windows/desktop/aa366551(v=vs.85).aspx example successfully. Right now Im trying to port the "second process" to fortran code.
I'm not very expirienced in win32 programming let alone fortran so pardon my ignorance if any.
Here's the fortran side of things:
USE KERNEL32, only: OpenFileMapping, MapViewOfFile, FILE_MAP_ALL_ACCESS
szName = "Global\MyFileMappingObject"
hMapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, .FALSE., szName)
if(hMapFile == 0) then
write(*,*) "OpenFileMapping failed"
pBuf = MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 256)
END PROGRAM secondprocess
When I run the program hMapfile fails, and i get an NaN error ("Not a Number" from what i've read)
I get the feeling that pointers should be involved, eg pBuf is declared as an integer yet i think it stores the memory location of the message.
Any ideas ?