Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28506 Discussions

Reading and Writing to memory mapped files via pointer in fortran


I've been working on a project where I'm trying to replicate some aspects of an application (originally written using c++ and fortran) using c# and fortran. One of the function I'm trying to replicate is passing information from a memory mapped file to c# to fortran and vice versa. 


I've been able to create the memory mapped files in c#, but what I'm struggling with is the data sharing. In the original application, we were able to create the memory mapped files, and then pass a pointer to a double array to the fortran, which was then able to read and write to that array. To try to replicate this in c#, I loosely followed the solution posted here:


It appears that the function I'm passing the pointer to in the fortran is receiving the correct data, but when I try to read or write to that array I get an access violation exception. Should I be doing this differently? 

0 Kudos
1 Reply
New Contributor III

Can you provide simplified and only essential example code for the mmf use? There are several possible explanations with the info given

0 Kudos