+ -
当前位置:首页 → 问答吧 → Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in

Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in

时间:2011-12-14

来源:互联网

问题显示:
Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'D:\xx\xx\bin\Debug\xx.exe'.
Additional Information: A call to PInvoke function 'TestInterface!Demo.Cppmy.Control::InitLogWorkDir' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

c#代码:
StringBuilder LogPath = new StringBuilder(xxxx);
InitLogWorkDir(LogPath.ToString().ToCharArray());

接口:
[DllImport("xxxx.dll",xxxxxxx)]
[SecuritySafeCritical]
private static void InitLogWorkDir(char[] logDir);

C++代码:
void InitLogWorkDir(wchar_t* logDir)
{
wstring logDirWStr = logDir;
Log::SetPath(logDirWStr);
return;


请问怎么修改
 谢谢

作者: lincolnxu0116   发布时间: 2011-12-14

http://topic.csdn.net/u/20110804/09/f35a170c-fee4-42be-83f4-abcc54ad6987.html

作者: Sandy945   发布时间: 2011-12-15