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

Calling Fortran from C#

Thomas_K_1
Начинающий
1 627Просмотр.
Hi,
I am new at mixed programming in .NET and Intel fortran, but I am having serious trouble getting .NET to recognize my .dll as valid. I get a message that the .dll is not a valid .net or com object. I took an old CVF project and tried importing that but got nothing better. Can somebody point me in the right direction. (I've even tried the mixed programming example in IF8 under mixed programming and got nowhere).
Thanx for the help.
Thom
0 баллов
2 Ответы
anthonyrichards
Новый участник III
1 627Просмотр.
Although this link http://arnholm.org/software/index.htmrefers to calling FORTRAN77 from C++, you may find it very useful. ALong with full documentation, It supplies header files, macros and classes etc. that you need to prototype calls to FORTRAN routines.
g_f_thomas
Начинающий
1 627Просмотр.
To call an unmanaged CVF/IVF dll from managed C# you need to use the P/Invoke technique in conjunction with the InteropServices namespace. Something like:

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace PInvokeDemo
{
class Class1
[DllImport("MyCVF.dll", EntryPoint="CallMe")]
static extern bool CallMe();

etc, etc.

HTH,
Gerry T.
Ответить