c#调用C++的DLL问题 ( 积分: 100 )

  • 主题发起人 主题发起人 djf813
  • 开始时间 开始时间
D

djf813

Unregistered / Unconfirmed
GUEST, unregistred user!
c++ 的DLL
pisn_putsnapshots ( int32 PIPTR *pt, float PIPTR *rval, int32 PIPTR *istat, int32 PIPTR *timedate, int32 PIPTR *err, int32 count );
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
我是这样调用的
[DllImport "piapi32.dll"]
public static extern int32 pisn_getsnapshots(int32[] pt, ref float[] rval, ref int32[] istat, ref int32[] timedate, ref int32[] err, itn32 count);
protected void button1_click(object snder, eventargs e)
{
int32[] pt = new int32[20];
float[] rval = new int32[20];
int32[] istat = new int32[20];
int32[] err = new int32[20];
int32[] timedate = new int32[20];
pt.[0] = 887;
pt.[1] = 889;
int32 count = 2;
int32 returnInt = pisn_getsnapshots(pt, ref rval, ref istat, ref timedate, ref err , count);
我调用这个DLL的其它几个函数都没问题,就这个函数调用错误,我不想用非安全代码,如何写在参数对应C++的数组指针?
 
自己解决,请斑竹删除该条问题
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
750
import
I
I
回复
0
查看
903
import
I
后退
顶部