c# 调用c DLL 所传参数不正确

C

void chaos(char * pBuf, long len, int type);

 

c# 

[DllImport("DecodeFileDll.dll", CallingConverntion = CallingConvertion.Cdecl)]

public static extern void chaos(byte[] pBuf, long len, int type);

 

c# 调用c的时候

choas(buf, 100,2);

但在C的时候,type总是为0

发现是C# long 为8个字节 c long 为4个字节。

统一一种类型:全部是long或全部是int

void chaos(char * pBuf, int len, int type);

 

你可能感兴趣的:(c# 调用c DLL 所传参数不正确)