问题描述
我有一个将字符串作为参数的c#dll。我需要从C ++ dll调用它。我无法弄清楚从c ++传递的将转换为字符串的类型。这是一个例子。
c ++代码
public:void CreateKey(wchar_t* sName,wchar_t* sValue)
{
API::API::CreateKey(*sName,*sValue); //this is the call to c# where it errors
return;
}
};
c#代码
public static void CreateKey(string sName,string sValue)
{
DoThing());
}
假设所有命名空间都是正确的。这似乎只与库之间的类型有关。
构建此文件时,我的错误是“错误C2664:无法将参数1从'wchar_t'转换为'System :: String'
我尝试了WCHAR,char *,LPCSTR,BSTR代替wchar_t的所有错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)