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

Sharing Fortran Memory with .NET C# (or Java)

tsmithapp-geo-resear
1,244 Views
Does anyone have experience with or can reference some sample code or documenton how to
share a Fortran memory spacefrom withina .NET C#program.Basically we have some large
arrays that we would rather not pass from one to the other but simply populate withFortran
and use inC# (or Java)
0 Kudos
4 Replies
onkelhotte
New Contributor II
1,244 Views
Does anyone have experience with or can reference some sample code or documenton how to
share a Fortran memory spacefrom withina .NET C#program.Basically we have some large
arrays that we would rather not pass from one to the other but simply populate withFortran
and use inC# (or Java)

I have never tested to exchange pointer adresses between C# and Fortran (thats what you intend to do, right?).

But if you even succeed in doing so, you have to keep in mind that Fortran and C# are saving arrays differently (one in column order, the other in row order...).

Markus
0 Kudos
tsmithapp-geo-resear
1,244 Views
Quoting - onkelhotte

I have never tested to exchange pointer adresses between C# and Fortran (thats what you intend to do, right?).

But if you even succeed in doing so, you have to keep in mind that Fortran and C# are saving arrays differently (one in column order, the other in row order...).

Markus
I was thinking more along the lines of shared memory. Two executables sharing a block of memory where the Fortran writes to the memory area and C# reads it.
0 Kudos
TimP
Honored Contributor III
1,244 Views
If you declare an array via iso_c_binding, it will appear the same as an array declared in unmanaged C code.
0 Kudos
Steven_L_Intel1
Employee
1,244 Views
My understanding is that C# runs only in the .NET environment so that it does not share memory with unmanaged code. You should use access routines in a DLL to share data.
0 Kudos
Reply