如何使用C#调用Fortran DLL函数

时间:2019-03-28 13:07:46

标签: c# dll fortran

我有下面代码的Fortran DLL。

想要使用C#代码调用此DLL函数。

我已经尝试使用下面的代码调用此DLL。

    [DllImport("Cndwmaindll.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
    public static extern void Cndwmaindll([In]string cond1in, [In]string cond2in, [In]double cgpmin, [In]double ecwtin, [In]double lcwtin, [In]double condffin,
        [In]double wbrinein, [In]string brnamein, [In]double thr1in, [In]double thr2in, [In]double tsat1in, [In]double tsat2in, [In]double dt1in, [In]double dt2in, [In]string hconfigin,
       [Out] double ctn1out, [Out] double ctn2out, [Out] double lt1out, [Out] double lt2out, [Out] double WPDFtout);

这是DLL函数的结构。

  character*4 cond1in, cond2in, brnamein
  real cgpmin, ecwtin, lcwtin, condffin, wbrinein,thr1in, thr2in
  real tsat1in, tsat2in, dt1in, dt2in
  character*3 hconfigin
  real ctn1out, ctn2out,lt1out, lt2out,WPDFtout

  cond1in = 'V058'
  cond2in = cond1in
  cgpmin = 125.00
  ecwtin = 85.00
  lcwtin = 0.00
  condffin = 0.00025
  wbrinein = 0.0
  brnamein = '00'
  thr1in = 31.4
  thr2in = 31.4
  tsat1in = 105.8
  tsat2in = 105.5
  dt1in = 160.0
  dt2in = 160.0
  hconfigin = 'STD'
  call Cndwmaindll(cond1in, cond2in, cgpmin, ecwtin, lcwtin, &
                   condffin, brnamein,wbrinein,thr1in, &
                   thr2in,tsat1in,tsat2in,dt1in,dt2in, &
                   hconfigin, &
                   ctn1out,ctn2out,lt1out,lt2out,WPDFTout)

0 个答案:

没有答案