如何封送包含字符矩阵的数组结构
How to marshal an array structure containing a matrix of char
基于以下C++标头内容:
typedef struct {
char myVar[30][50];
}MyStruct;
extern "C" int WINAPI MyFunction(MyStruct *Configuration,int *CfgSize);
我在互联网上寻找了很多例子,但没有一个使用结构数组中的矩阵变量作为参数。
有人可以告诉我如何在 C# 中使用这个函数吗?
为了封送这个数组成员,你只需要把它展平到它所代表的 1500 个元素
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct MyStruct {
/// byte[1500]
[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst=1500, ArraySubType=UnmanagedType.I1)]
public byte[] myVar;
}
请确保在 C# 中使用时手动初始化myVar
数组
相关文章:
- 从函数中全局删除并重新实例化数组结构,而无需在编译时知道数组的大小
- 如何使用函数的输出初始化 const 数组结构字段?
- 传递数组结构、ofstream 和 interger 以运行
- 从文本文件中读取并输入到数组结构中,然后显示读取的数据C++
- 将文本文件读取到数组结构中
- C/C++中数组结构和数组结构的通用接口
- C++ MDC final-在字符类型的数组结构中按字母顺序对记录中的名称进行排序
- C++ 使用数组结构创建平衡的二叉搜索树
- C++:释放动态数组(结构成员)和指向此结构的指针的方法
- 使用 vector 在 c++ 中声明 3D 数组结构
- 数组结构无法正确打印
- 如何在C++中访问数组结构内部的数组结构
- CIN进入数组结构似乎什么也没输入
- ifstream将数组结构到txt文件中,然后尽可能将其提取为数组
- wlanapi-将WlanFreeMemory释放其WLAN_INTERFACE_INFO数组结构
- 显示数组结构 c++
- C++ 使用函数访问数组结构的方法是什么?
- 将庞大的数组结构复制到 GPU
- 如何封送包含字符矩阵的数组结构
- C++多维数组结构的对齐