请教C#调用C++dll的一个小问题
调用一个第三方的相机dll,几句简单的代码,同样的代码在VB中没有问题,C#中却取不到数据.代码如下:
VB:
Private Declare Function KZPreviewOneVideoFrameRGB Lib "kzdsc.dll" (ByRef lpBuf As Byte) As Boolean
...
Dim buf(829440) As Byte
bRet = KZPreviewOneVideoFrameRGB(buf(0)) //运行后buf能得到数据
C#:
[DllImport("kzdsc.DLL", CallingConvention = CallingConvention.StdCall)]
public static extern bool KZPreviewOneVideoFrameRGB(byte[] buffer); //ref byte[] buffer 也无法得到数据
...
byte[] buf = new byte[829441];
bRet = KZPreviewOneVideoFrameRGB(buf); //执行后buf得不到数据
猪八戒网答谢地址:task.zhubajie.com/3550651/