c# - 如何使用 C# 调用 Fortran DLL 函数
问题描述
我有 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)
解决方案
推荐阅读
- python-3.x - POSTMAN 是否支持 http2 请求
- git - .gitignore 不忽略和删除缓存不修复
- c# - 在创建要从 [FromBody] 接收某些字段的 Web 请求时如何指定
- node.js - 刷新猫鼬后默认生成的值(短网址)更改
- php - 根据仅保留最新的值删除数组中的重复对象(基于时间戳的第二个值)
- python - Selenium 用一个扭曲的 Python 滚动到视图中
- python - python在clojure中的累积等价物
- java - Docker compose 无法在 java 和 mysql 容器之间建立连接
- python - 到达某一行后如何停止程序?
- python - python 3.8中的Tensorflow安装错误