有人可以指出我在这里做错了什么吗?
FORTRAN 77 dll 代码
*$pragma aux DON "DON" export parm(value*8,value*8)
SUBROUTINE DON(DAA,DBB,DCC)
REAL*8, DAA,DBB,DCC
DBB=DAA+1
DCC=DBB+1
RETURN
END
C# 代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace pDON
{
class Program
{
[DllImport("DON.dll",
CharSet = CharSet.Auto,
CallingConvention = CallingConvention.StdCall)]
public static extern void DON(
[MarshalAs(UnmanagedType.R8)] double DAA,
[MarshalAs(UnmanagedType.R8)] double DBB,
[MarshalAs(UnmanagedType.R8)] double DCC
);
static void Main(string[] args)
{
//double TIME = 100.0;
double DAA = 5.5;
double DBB = 7;
double DCC = 9;
//START( ENERIN, VAL1);
DON(DAA, DBB, DCC);
Console.Write("val1 = " + DBB);
Console.Write("val2 = " + DCC);
Debug.WriteLine("VAR = " + DBB.ToString());
Console.Write("Press any key to exit");
Console.ReadKey(false);
}
}
}
我想将 DBB DCC 的值返回到 C# main prog ..通过 FORTRAN 77 子例程处理它们之后。
PS:我不能像使用 fortran 77 一样使用 INTENT(out)。在此先感谢。