【发布时间】:2012-07-03 16:44:00
【问题描述】:
我在 delphi 中调用 C++ DLL 时遇到一些问题,DLL 是用 Labview 编写的,但 DLL 语法都是 C++,我认为主要问题是尝试将数据作为动态数组传递给函数double (本质上是一个指针对吗?)
.h头文件中的函数定义为:
int16_t __cdecl NRELIVparExtract(
double voltageV[],
double currentA[],
int32_t nDataPoints,
uint16_t fitAlgorithim,
int16_t *twoOrLessPoints,
double *Voc,
double *Isc,
double *Vmp,
double *Imp
);
我试图用来调用它的 delphi 代码是:
public { Public declarations }
end;
var
Function NRELIVparExtract (voltageV, currentA: Array of Double; nDataPoints :Integer;
fitAlgorithim :Word; Var twoOrLessPoints : SmallInt;
Voc, Isc, Vmp, Imp : Double): smallint ; CDecl;External IVparExtract_NREL.dll'
废话
procedure TFormMainIVanalysis.ExtractNREL(InputFileName : ShortString);
var
VoltArray, CurrArray : Array Of double;
blah
Begin
NRELresult := NRELIVparExtract(VoltArray,CurrArray,NpointsForFitting, fitAlgorithm, twoOrLessPoints, LVoc, LISc, LVmpp, LImpp);
当编译器到达我的 delphi .dpr 中的开始行时,我得到不同的访问冲突错误,或者我得到 IVparExtract_NREL.dll 未找到
欢迎任何建议,干杯,布赖恩
【问题讨论】:
-
函数末尾的双打是指针是不是漏掉了什么?
-
啊...我们可能已经找到了解决方法。我们将完整路径放在外部之后,就像这样 External 'E:\blah\IVparExtract_NREL.dll' 现在它似乎找到了 DLL 但我们现在只需要安装 NI labview 运行时引擎...
-
还要注意LabVIEW双打是大端,而Win平台是小端
-
你的意思是 LabView 双浮点值不兼容 C 双精度/浮点数?
-
实用程序 'HeadConv'(edn.embarcadero.com/article/26451) 可能会有所帮助。