请帮忙看一下这个DLL调用的函数,参数怎么写

ihpled ihpled 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
pisn_getsnapshots
This function retrieves the most recent values sent to the pi System for an array of points. The snapshot values in engineering units, status codes, times, dates, and errors are returned in the passed parallel arrays. If the point type is not real, the value is returned in istat and the rval argument is returned as 0.

C format

int32 pisn_getsnapshots(
int32 PIPTR * pt
float PIPTR * rval,
int32 PIPTR * istat,
int32 PIPTR * timedate,
int32 PIPTR * error,
int32 count );
Returns
>0
System error
0
Success
-1
Point not found

Arguments
pt (passed)
Array of point numbers
rval (returned)
Array of values in engineering units, undefined for integer and digital points
istat (returned)
Array of statuses for type real points and values for integer and digital points
timedate (returned)
array of time stamps
error (returned)
Array of error codes
count(passed)
Size of the arrays
pi Toolkit Reference
GetSnapshot

以下是VB的定义
Declare Function pisn_getsnapshots Lib "piapi32.dll" (pt&, rval!, istat&, timedate&, piapierror&, ByVal count&) As Long

我是这样定义的
function pisn_getsnapshots(pt:array of Integer;rval:array of single;istat:array of Integer; timedate:array of Integer; error:array of Integer; count: Integer):Integer;stdcall;external 'piapi32.dll';


调用的时候
var
pt:array[0..20] of Integer;
rval:array[0..20] of single;
istat:array[0..20] of Integer;
timedatePt:array[0..20] of Integer;
errorPt:array[0..20] of Integer;
countPt: Integer

i:=getsnapshots(pt[0],rval[0],istat[0],timedatePt[0],errorPt[0],countPt);

i的值为0表示调用成功,但是rval[0]。。rval[20],的值都不正常,我把上面的句函数调用注释掉,rval[0]..ravl[20]的值仍不变,证明rval的数值在函数中没有被赋值,请高手帮忙看一下,是不是我的定义有问题,还是调用方法有问题


...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
ihpled
非技术区 830 成员 53,568 内容