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 have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29305 Discussions

Reading and Writing to memory mapped files via pointer in fortran

ibryant
Beginner
823 Views

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: https://stackoverflow.com/questions/31179076/how-to-get-an-intptr-to-access-the-view-of-a-memorymappedfile.

 

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
MWind2
New Contributor III
817 Views

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

0 Kudos
Reply