请教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/
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/
...全文
相关推荐
C#使用CLR调用C++的DLL库
C#使用CLR调用C++的DLL库的windows完整解决方案 说明如下: 1、工程一:C++的DLL 2、工程二:C++的CLR的类库 3、工程三:C#的exe
C#引用C++动态库 dll 实例
C#引用C++动态库 dll 实例 项目含有C++编写DLL C#引用C++dll
CSharp调用Cpp代码完整实例.zip_C# CPP_C#中cpp_c#代码生成dll_c#调用cpp文件_c#调用c编写d
c#调用C实例。c通过生成DLL,里面有方法,需要一定格式。
在VS2010上使用C#调用非托管C++生成的DLL文件
在VS2010上使用C#调用非托管C++生成的DLL文件
C#调用C++DLL
自己在网上找的C#调用Dll的方法,这几天搞晕老,希望对其他朋友有所帮助!


