易语言无法调用c语言的dll文件路径,易语言指针及调用dll函数总是出错,很不理解...

c语言是计算空气物性的,需要调用refprop.dll。但是转换到易语言就不太懂,HINSTANCE 、strcpy、 strcat等用易语言怎么实现呢?自己写了几句易语言代码,一点都不通,写的也是挺乱。还希望有大神可以指点一下,最好能帮我调试一下,小弟感激不尽。C语言的原文件、.h 及.dll文件和数据库都放在附件中了。C语言中代码如下:

#include

#include

#include "refprop1.h"

// Some constants...

const long refpropcharlength=255;

const long filepathlength=255;

const long lengthofreference=3;

const long errormessagelength=255;

const long ncmax=20;  // Note: ncmax is the max number of components

const long numparams=72;

const long maxcoefs=50;

int main(int argc, char* argv[])

{

// First create a pointer to an instance of the library

// Then have windows load the library.

HINSTANCE RefpropdllInstance;

//This looks only in the current directory for refprop.dll

RefpropdllInstance = LoadLibrary("./refprop.dll");

// Then get pointers into the dll to the actual functions.

INFOdll = (fp_INFOdllTYPE) GetProcAddress(RefpropdllInstance,"INFOdll");

SATTdll = (fp_SATTdllTYPE) GetProcAddress(RefpropdllInstance,"SATTdll");

SETUPdll = (fp_SETUPdllTYPE) GetProcAddress(RefpropdllInstance,"SETUPdll");

// Now use the functions.

// Refprop variables that need to be defined

//

// nc = Number of components in the mixture

// x[NumberOfComponentsInMixtures] = Mole fraction of each component

// ierr =  An integer flag defining an error

// hf[] = a character array defining the fluids in a mixture

// hrf[] = a character array denoting the reference state

// herr[] = a character array for storing a string - Error message

// hfmix[] a character array defining the path to the mixture file

double x[ncmax],xliq[ncmax],xvap[ncmax],f[ncmax];

long i,ierr;

char hf[refpropcharlength*ncmax], hrf[lengthofreference+1],

herr[errormessagelength+1],hfmix[refpropcharlength+1];

//Exlicitely set the fluid file PATH

//char *FLD_PATH;

//FLD_PATH = "C:\\Program Files\\REFPROP\\fluids\\";

//   strcpy(hf,FLD_PATH);

//   strcpy(hfmix,FLD_PATH);

//...initialize the program and set the pure fluid component name

//i=1;

//strcpy(hf,"nitrogen.fld");

//strcpy(hfmix,"hmx.bnc");

//strcpy(hrf,"DEF");

//strcpy(herr,"Ok");

//...For a mixture, use the following setup instead of the lines above.

// Use "|" as the file name delimiter for mixtures

i=1;

strcpy(hf,"nitrogen.fld");

//   strcat(hf,"|argon.fld");

//   strcat(hf,"|oxygen.fld");

strcpy(hfmix,"hmx.bnc");

strcpy(hrf,"DEF");

strcpy(herr,"Ok");

x[0]=1;     // 目前仅用N2

//x[1]=0;

//x[2]=0;

//...Call SETUP to initialize the program

SETUPdll(i, hf, hfmix, hrf, ierr, herr,

refpropcharlength*ncmax,refpropcharlength,

lengthofreference,errormessagelength);

if (ierr != 0) printf("%s\n",herr);

double wm,ttp,tnbp,tc,pc,dc,zc,acf,dip,rgas;

long info_index=1;

INFOdll(info_index,wm,ttp,tnbp,tc,pc,dc,zc,acf,dip,rgas);

printf("WM,ACF,DIP,TTP,TNBP   %10.4f,%10.4f,%10.4f,%10.4f,%10.4f\n",wm,acf,dip,ttp,tnbp);

printf("TC,PC,DC,RGAS         %10.4f,%10.4f,%10.4f,%10.4f,%10.4f\n",tc,pc,dc,rgas);

return 0;

}

补充内容 (2018-9-5 22:02):

C语言文件中有我自己写的易语言程序,请大神帮我看一看。谢谢!

654c89f6d49e8b0cd290bd4e160fa215.gif

2018-9-5 20:46 上传

点击文件名下载附件

681.25 KB, 下载次数: 2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值