After switching to VS2010, the managed debug assistant is displaying an error about an unbalanced stack from a call to an unmanaged C++ function from a C# application.
The VS2008 built C++ dll and C# application never had a problem.
Decision:
- Use __stdcall on your C++ function Examble:
- Declare CallingConvention = CallingConvention.Cdecl on your DllImport
- Use a compiler switch that will turn on stdcall as the default calling convention: -Gz
short __stdcall SuperSpecialOpenFileFunc(SuperSpecialStruct * stuff);
About pInvokeStackImbalance MDA:
http://msdn.microsoft.com/en-us/library/0htdy0k3.aspx
0 коммент.:
Post a Comment