我有一个ac#程序,用于从c ++ dll检查数据库字符串。
我的字符串顺利通过,没有错误,但是我的问题是它们在C ++ dll中不匹配。
我试图用Messagebox,Console和Everything检查它们,它们在字符,大小,文本上是相同的...
但是如果Else总是返回false ...
我的C ++代码(test_match.dll):
extern "C" __declspec(dllexport) int check_string(const char* string_from_csharp);
int check_string(const char* string_from_csharp)
{
if (string_from_csharp == "hello world!" ){
return 1;
}else{
return 0;
}
}
我的C#代码:
[DllImport("test_match.dll",
CallingConvention = CallingConvention.Cdecl ,
CharSet = CharSet.Unicode)]
private static extern int check_string(string string_from_csharp)
我的C#使用代码(WPF):
int get_match_state = check_string(inputtext.Text);
C ++中的MessageBox表示...输入是“世界您好!”
但它总是返回0
另外,我尝试使用find()将它们转换为wchar_t,std :: string,但没有任何改变。
我在哪里犯错? 谢谢
HUH函数
噜噜哒
慕桂英3389331
随时随地看视频慕课网APP
相关分类