錯誤信息以下 this
Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'D:\MyProject\C#\CSharpInvokeCpp.CSharpDemo\CSharpInvokeCpp.CSharpDemo\bin\Debug\CSharpInvokeCpp.CSharpDemo.vshost.exe'.
Additional Information: A call to PInvoke function 'CSharpInvokeCpp.CSharpDemo!CSharpInvokeCpp.CSharpDemo.CPPDLL::Sub' 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. orm
解決方案以下: get
http://stackoverflow.com/questions/5602645/why-do-i-get-pinvokestackimbalance-was-detected-for-this-simple-example it