c ++ dll interfaces of prototype: int CheckSN (const char * InfoList, char * msg);
c # calls into:
[DllImport("sncplusInterface.dll", EntryPoint = "CheckSN", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern int CheckSN(string InfoList, StringBuilder msg);
Call is:
StringBuilder chOutMsg = new StringBuilder(1024);
CheckSN(chData, chOutMsg/*ref chOutMsg*/);
string str = chOutMsg.ToString();
With the ref or out keyword crash