我需要从 win32 dll 访问功能,因为我在 C# 代码中使用 [dllimport]。
我需要使用 [dllimport] 为以下 C++ 方法创建什么确切的方法签名
void GetGeneratedKey(char *code, int len, char *key)
请帮忙。
谢谢
nRk
最佳答案
这在很大程度上取决于 native C 函数中变量 key
和 code
发生的情况。根据签名,我猜测 code
正在被读取并且 key
正在被写入。如果是这种情况,请尝试以下签名
[DllImport("SomeDll")]
public static extern void GetGeneratedKey(
[In] string code,
[In] int length,
StringBuilder key);
关于c# - 如何从 C# 中的 dll 导入访问/编码 char *变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2336144/