I’ve not found any posts on Stack Overflow that discuss calling C# from Fortran (I’m using Visual Studio 2010 with Intel Visual Fortran installed as well). However, there is a (very) limited # of posts[1, 2, 3 ] that discuss calling C/C++ from fortran.
In one of the responses to these posts, it was suggested that calling C++ from Fortran is trickier than calling C, which raised my suspicions that C# may be trickier yet? Lacking a foundation in C/C++/C#, I’m wondering if the procedures laid out for C/C++ are applicable to C#?
One commonality I noticed among these posts was that the intrinsic module called ISO_C_BINDING was needed. After reading a bit more about it here, it wasn’t clear to me that ISO_C_BINDING would allow me to pass a couple of 2D-arrays worth of information to a program (compiled as a DLL) written in C#, call some ‘events’ (analogous to functions?), and finally get back a 2D-array of information from C# , before moving on about my business in Fortran.
If familiar with both Fortran and C#, could you please tell me if ISO_C_BINDING is adequate to the task? I’ve not gotten that sense from the information I’ve listed above. If anyone has a working example that includes passing arrays between C# and Fortran, as well as calling C# functions from Fortran, I would very much appreciate the opportunity to look it over as a template for how I might proceed. Thanks, Eric