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

Mixed language (fortran , C ,C# ) for windows form application in Visual Studio 2010 expres

Deb_M_
Beginner
861 Views

I am working on a mixed language projoject. I am going to develo an windows form application using C# on visual studio 2010 express. Would anyone  help me on the following problems:

1> I have "c" codes whcich  calls fortran functions and sub routines

2> I have fortan functions/subroutines which calls "c" codes  

3> I want to make dll from the above codes and want to use them in my windows form application using C# under visual studio

How do I compile the c and fortran code to make dll ( both 32/64 bit) for using them in C# code. How to setup visual studio 2010 express. Please help me with two prototype examples (c/fortran c# and fortran/c c# ) which can handle two-dimensional array.

Thanks

Deb

0 Kudos
1 Reply
Steven_L_Intel1
Employee
861 Views

You have a couple of obstacles to overcome, initially. The first is that Intel Fortran is not supported under "Express" editions of Visual Studio due to Microsoft restrictions. It may be possible to install VS2010 Express and Intel's provided VS2010 Shell-based Fortran environment side-by-side on the same system, but I am not entirely sure this will work. You could build Fortran code from the command line, but would not be able to debug it.

The second is your desire to support both 32-bit and 64-bit - this is problematic because C# will have difficulty selecting the "correct" DLL if you build it for "Any CPU". You can specify the C# build configuration for "Win32" or "x64" explicitly and then have it load the appropriately built DLL. You can look at the VB.NET samples we provide to see an example of how this is done.

Arrays may also be a problem - I am not well versed in C#, but neither C nor C++ have anything that map directly onto Fortran two-dimensional arrays. Typically, what looks like a two-dimensional array in the C-style languages is an array of pointers to arrays. You can deal with this in Fortran but it is not simple.

It would be easiest to help you if you gave us some simple example of what you'd like to work.

0 Kudos
Reply