Calling a C++ dll with unsigned char* parameters
unsigned char* 等价 BYTE*
例1:
C++:
int __stdcall LIVESCAN_GetFPRawData(int nChannel, unsigned char *pRawData);
C#
[DllImport("GALS1701.dll", EntryPoint = "LIVESCAN_GetFPRawData", CallingConvention = CallingConvention.Cdecl)]
unsafe public static extern int GetFPRawData(int nChannel, byte* pRawData);
unsafe
{
Byte[] bytes = new Byte[ * + ];
//就是固定“fixed 语句禁止垃圾回收器重定位可移动的变量”
fixed (byte* array = bytes)
{
Livescan.GetFPRawData(, array);
}
}
例2:
C++
extern "C" _declspec(dllexport) int Auto_Capture(BYTE *pBmpData)
C#
[DllImport("LivescanDll.dll", EntryPoint = "Auto_Capture", CallingConvention = CallingConvention.Cdecl)]
public static extern int Auto_Capture(Byte[] pBmpData);
Byte[] bytes = new Byte[ * + ];
int result = Livescan.Auto_Capture(bytes);
Calling a C++ dll with unsigned char* parameters的更多相关文章
- C#封装C++DLL(特别是char*对应的string)
1.新建一个C#-Windows-类库(用于创建C#类库(.dll)的项目)类型的工程 2.对于普通C++函数 XXXX_API void cppFun(int i); 在cs代码中添加 [DllIm ...
- c++unsigned char的输出问题
unsigned char的范围是0~255,在用cout输出的时候要显示数字的话记得进行int的强制转化才可以,否则都是输出的字符,除此之外的所有比较转换成整数在做比较吧 除此之外,在最近的项目里由 ...
- unsigned char 类型
在蓝牙4.0的开发中,很多数据类型都用到了 unsigned char ,我觉得用这个类型的一个原因是相比较于整型,它占的空间更少. 比如: unsigned char a = 1; // 占1个字 ...
- char、unsigned char、BYTE
首先uchar就是BYTE:Typedef unsigned char BYTE: char:就是signed char,是一个字节,8个位.第8位是符号位,所以可以表示-128~127共256个符号 ...
- unsigned char 无符号整形 减法运算
对于一个字节来说: unsigned char : 0 ~ 255 0000 0000 ~ 1111 1111 char :-128 ~ 127 ...
- char, signed char, and unsigned char in C++
关于这三者的区别stackoverrflow里有一个答案是这样说的: 3.9.1 Fundamental types [basic.fundamental] 1 Objects declared as ...
- unsigned char 转字符串:
通常送显示的都是字符串,对于int long float转字符串有对应的函数,还有sprintf进行格式输出,对于嵌入式和单片机大多都用unsigned char型变量,转字符串需要自己编写函数,需要 ...
- signed char、unsigned char
什么是无符号char类型?与常见的char类型有何不同? 在c++中有三种不同的字符类型:char,signed char,unsigned char.如果要应用与文本字符,就使用不加限制的char类 ...
- char 与 unsigned char的本质区别
在C中,默认的基础数据类型均为signed,现在我们以char为例,说明(signed) char与unsigned char之间的区别 首先在内存中,char与unsigned char没有什么不同 ...
随机推荐
- Reflow、Repaint 性能优化
涉及到操作大量Dom节点及其样式时,有时感觉画面不顺畅,殊不知浏览器亚历山大了.所以我们心里面一定得清楚 Reflow(回流).Repaint(重绘). 浏览器根据每个Dom节点的样式,包括(大小,颜 ...
- Yii2——MYSQL操作
先创建连接对象 $connection = new \yii\db\Connection([ 'dsn' => $dsn, 'username' => $username, 'passwo ...
- laravel框架——学习笔记
routes.php文件创建路由参数由{}包起来,不需要$ Route::get('/stu/{as}','StuController@show'); 在相对应的Controller创建funcito ...
- JQuery整体大纲
今天公司放假,闲的无聊,就总结了一套JQuery的笔记,我感觉更像是大纲,在这里跟大家分享一下,这是我的成果: 这个就是我的劳动成果了,说实话真是不容易,为了做这个东西,翻阅了很多以前做过的笔记,发现 ...
- 浏览器的模式问题 Quirks Mode vs Standards Mode
当微软开始产生与标准兼容的浏览器时,他们希望确保向后兼容性.为了实现这一点,他们IE6.0以后的版本在浏览器内嵌了两种表现模式: Standards Mode(标准模式或Strict Mode)和Qu ...
- 主流屏幕对比:IPS/LTPS/CGS/IGZO/AMOLED
IPS.LTPS.CGS.IGZO.AMOLED都是什么屏幕又有什么区别?目前的手机屏幕技术实在太多,本文旨在介绍各种面板以及屏幕技术,便于大家更好地进行区分. 近年来手机屏幕技术层出不穷,早在几年前 ...
- 查看Linux某个进程打开的文件句柄(file descriptor)数量
先找到进程的pid 然后: lsof -p [pid] | wc -l 或者 ls /proc/[pid]/fd | wc -l 查看系统总共使用中的文件描述符数量: lsof | wc -l ref ...
- Prime邻接表+优先队列
#include <iostream> #include <cmath> #include <cstring> #include <cstdlib> # ...
- SPFA 最短路径打印方法
#include <iostream> #include <cstdlib> #include <cstdio> #include <algorithm> ...
- [Design Pattern] Proxy Pattern 简单案例
Proxy Pattern, 即代理模式,用一个类代表另一个类的功能,用于隐藏.解耦真正提供功能的类,属于结构类的设计模式. 下面是 代理模式的一个简单案例. Image 定义接口,RealImage ...