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

Interoperability between .NET and Intel Fortran

calgarian
Beginner
536 Views
Hi there,
 
We are in the process of evaluating Intel Fortran for Windows.
 
We plan to use a.Net language (VB.Net for eg.) as the front end. Could any one please tell the different ways i can interact with Intel Fortran from VB.Net (or C#.Net).
 
I know that the Intel Fortran source can be packaged to a DLL and then called from VB.Net. I am looking for better options with true interoperability.
 
Would greatly appreciate your replies.
 
Cheers!
0 Kudos
13 Replies
Paul_Curtis
Valued Contributor I
536 Views
You can write"native" Win32-API codein F90as easily and with as much versatility as any other language. There is no need for .NET anything to make F90 apps with full-featured Win32 user and system interfaces.
0 Kudos
calgarian
Beginner
536 Views
Thanks.
But the idea is to use .Net as the front end and Fortran for the complex engineering calcs.
So in what ways can i access Fortran code from .Net (without using a DLL).
Thanks very much.
0 Kudos
Steven_L_Intel1
Employee
536 Views
Without using a DLL, not at this time using Intel Fortran.
0 Kudos
Steven_L_Intel1
Employee
536 Views
Using a DLL is the only approach supported, but what do you mean by "true interoperability"? You should be able to do most anything you want, given some effort.
0 Kudos
calgarian
Beginner
536 Views
Thanks Steve.
What i mean is like in Salford Fortran, they have an interface that supports calls from outside. You do not have to declare a DLL in the VB program. Just adding a reference will do it.
real*8 function add_ (x, y)

assembly_interface (name="Add")

Wondering if you have good example(s) to access Intel Fortran from VB.Net and C#.Netusing DLLs and a document explaining rules for data type mapping between VB.Net and Intel Fortran. I would greatly appreciate that.

Cheers!

0 Kudos
Steven_L_Intel1
Employee
536 Views
Ok. Salford Fortran supports direct generation of MSIL, and has added features to support that. Intel Fortran generates native code only.

I have a VB.NET example I'll post in a bit. I don't have a document specifically oriented at this. Mostly you would use the information in our mixed-language applications chapter on datatypes and the VB.NET or C# documentation on interfacing with native DLLs. For simple datatypes and arrays, it's pretty easy to pass them. If you want to handle SafeArrays and BStrings, it's more complex.
0 Kudos
calgarian
Beginner
536 Views
Thanks for the clarification. Would i right in saying that the native code that IntelFortran generates will run faster than the MSIL?
Please post the VB.NET example for accessing a Fortran DLL.
Thanks...
0 Kudos
Steven_L_Intel1
Employee
536 Views
Yes, the native code will be much faster.

Here's the example (I hope attachments are working...)
0 Kudos
calgarian
Beginner
536 Views
Thanks Steve. That helps.
I have a rather annoying problem now.
I am not able to edit the fortran (.f90) source file the way i would edit a VB.Net program for example. In other words, I am not able to click some where in the source code and press the to delete characters and i am not able to press to insert a newline etc.
But i am able to type anywhere by clicking or even able to use key. I am able to save these chages as well. So its not a problem with this file being read only. But the , and the arrow keys are not working on .f90 file from the .Net Text Editor.
Wondering what i am doing wrong. This happens even with a new Intel FortranSource file. An other non-intel projects work fine in the text editor.
I would greatly appreciate your help on how i can edit .f90 files within .Net as i would edit any other file.
Please reply at your earliest.
Cheers!
0 Kudos
Steven_L_Intel1
Employee
536 Views
You have Lahey Fortran installed, am I right? It corrupts the VS.NET environment in just this way. It could be that Salford does this too, but I haven't heard of reports of that.

Most users who encounter this find that uninstalling Lahey fixes the problem. But here's another way.

1. Uninstall the Intel Visual Fortran Integration into Visual Studio
2. In Add or Remove Programs, select Visual Studio.NET and click Change.
3. In the VS.NET install screen that comes up, click item 2, Visual Studio.NET
4. Select Reinstall/Repair
5. When it is done, reinstall the Intel integration.

Please be sure that you have at least version 9.0.020 of Intel Fortran installed. 9.0.021 will probably become available from the Premier Support file downloads site tomorrow.
0 Kudos
calgarian
Beginner
536 Views
Yes, I have Lahey installed as well.
I will try the instructions and let you know how it went.
Thanks for your help.
0 Kudos
calgarian
Beginner
536 Views
Thanks Steve.
It works now. Thanks for your help. Appreciate it.
0 Kudos
Nupur_G_
Beginner
536 Views
This comment has been moved to its own thread
0 Kudos
Reply