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的更多相关文章

  1. C#封装C++DLL(特别是char*对应的string)

    1.新建一个C#-Windows-类库(用于创建C#类库(.dll)的项目)类型的工程 2.对于普通C++函数 XXXX_API void cppFun(int i); 在cs代码中添加 [DllIm ...

  2. c++unsigned char的输出问题

    unsigned char的范围是0~255,在用cout输出的时候要显示数字的话记得进行int的强制转化才可以,否则都是输出的字符,除此之外的所有比较转换成整数在做比较吧 除此之外,在最近的项目里由 ...

  3. unsigned char 类型

    在蓝牙4.0的开发中,很多数据类型都用到了 unsigned char ,我觉得用这个类型的一个原因是相比较于整型,它占的空间更少. 比如: unsigned char a = 1;  // 占1个字 ...

  4. char、unsigned char、BYTE

    首先uchar就是BYTE:Typedef unsigned char BYTE: char:就是signed char,是一个字节,8个位.第8位是符号位,所以可以表示-128~127共256个符号 ...

  5. unsigned char 无符号整形 减法运算

    对于一个字节来说: unsigned char :     0  ~  255              0000 0000  ~ 1111 1111 char :-128  ~  127       ...

  6. char, signed char, and unsigned char in C++

    关于这三者的区别stackoverrflow里有一个答案是这样说的: 3.9.1 Fundamental types [basic.fundamental] 1 Objects declared as ...

  7. unsigned char 转字符串:

    通常送显示的都是字符串,对于int long float转字符串有对应的函数,还有sprintf进行格式输出,对于嵌入式和单片机大多都用unsigned char型变量,转字符串需要自己编写函数,需要 ...

  8. signed char、unsigned char

    什么是无符号char类型?与常见的char类型有何不同? 在c++中有三种不同的字符类型:char,signed char,unsigned char.如果要应用与文本字符,就使用不加限制的char类 ...

  9. char 与 unsigned char的本质区别

    在C中,默认的基础数据类型均为signed,现在我们以char为例,说明(signed) char与unsigned char之间的区别 首先在内存中,char与unsigned char没有什么不同 ...

随机推荐

  1. Caffe Python特征抽取

    Caffe Python特征抽取 转载 http://www.cnblogs.com/louyihang-loves-baiyan/ Caffe大家一般用到的深度学习平台都是这个,关于Caffe的训练 ...

  2. -_-#【Canvas】

    context.lineWidth = 0.5 incorrect display lineWidth=1 at html5 canvas canvas.save() canvas.restore() ...

  3. 【转】vim 修改tab为四个空格

    原文网址:http://blog.sina.com.cn/s/blog_620ccfbf01010erz.html 为了vim更好的支持python写代码,修改tab默认4个空格有两种设置方法: 1. ...

  4. Minimum Path Sum——LeetCode

    Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which ...

  5. C++注释和doxygen注释

    C++注释 C++的注释只有两种: 单行注释,以“//”开头: 段落注释,以“/*”开始,以“*/”结束. int value; // value是一个整型变量,这是一句单行注释 /* Test是一个 ...

  6. C#实现数据结构——线性表(上)

    什么是线性表 数据结构中最常用也最简单的应该就是线性表,它是一种线性结构(废话,不是线性结构怎么会叫线性表?当然不是废话,古人公孙龙就说白马非马,现代生物学家也说鲸鱼不是鱼). 那什么是线性结构? 按 ...

  7. mac上安装redis

    1.从http://redis.io 下载redis包,这里选择了redis-3.2.3 2.将下载的 redis-3.2.3.tar.gz 包拷贝到 /user/local 目录 3.执行 sudo ...

  8. Hitting the 2100 parameter limit (SQL Server) when using Contains()

    1down vote My solution (Guides -> List of Guid): List<tstTest> tsts = new List<tstTest&g ...

  9. Android中如何将dp,dip,sp与px相互转化

    Android中有很多度量单位:比如常用的dp,dip,sp,px等,有时候需要将他们相互转换,有下面非常方便的方法: 比如sp转换成px: TypedValue.applyDimension(Typ ...

  10. [Flexbox] Using flex-direction to layout content horizontally and vertically

    The Flexbox css spec allows for more adjustable layouts. The flex-directionproperty allows you to ea ...