【发布时间】:2018-06-18 19:39:59
【问题描述】:
我已经阅读了大部分提示,但我无法让它发挥作用。
我有一个带有这个原型的原生 C dll:
int utl_Conv_HexString(U8 u8_Mode, void* DataIn, void* DataOut, int *piInOutLen, int maxOutLen);
这个 dll 转换字节数组中的几种字符串格式:
该dll用于具有非托管代码(用C编写)的系统中
现在我想在 C#/WPF 环境中使用这个 dll。
我仍然在 C# 中使用其他 dll,但都有没有 void* 的原型。
来自 C 的示例:
//ByteArr to Telegramm
u8_Dst[0] = 0xAA;
u8_Dst[1] = 0xBB;
u8_Dst[2] = 0xCC;
u32_InOutLen = 3;
s32_res = utl_Conv_HexString(UTL_CONV_BYTEARR_TO_TELEGRAM, u8_Dst, ac8_Src, &u32_InOutLen, sizeof(ac8_Src));
或
strcpy(ac8_Src, "0xAA,0xBB,0xCC");
memset(u8_Dst, 0, sizeof(u8_Dst));
s32_res = utl_Conv_HexString(UTL_CONV_TELEGRAM_TO_BYTEARR, ac8_Src, u8_Dst, &u32_InOutLen, sizeof(u8_Dst));
我的问题是我不知道如何在 C# 中使用它
【问题讨论】:
-
将
byte[]用于void*,ref int用于int*