private static bool TestMethod_DelegatePInvokeStdcall() { TestFramework.BeginScenario("Delegate Pinvoke stdcall"); bool breturn = true; try { DelegatePInvokeStdcall caller = MarshalRefInt_DelegatePInvoke_StdCall(); int i = 10; if (!caller(ref i)) { breturn = false; TestFramework.LogError("009", "TestMethod_DelegatePInvokeStdcall:The return value is wrong(Managed Side)"); } if (iNative != i) { breturn = false; TestFramework.LogError("010", "TestMethod_DelegatePInvokeStdcall:The value(i) hasnt changed by Native"); } } catch (Exception e) { breturn = false; TestFramework.LogError("010", "UnExpected Exception" + e.ToString()); } return(breturn); }
private static bool TestMethod_DelegatePInvokeStdcall() { TestFramework.BeginScenario("DelegatePinvoke,Cdecl"); bool bresult = true; try { char[] p = new char[LEN]; for (int i = 0; i < LEN; i++) { p[i] = (char)('a' + i); } DelegatePInvokeStdcall caller = DelegatePinvoke_Stdcall(); if (!caller(ref p)) { bresult = false; TestFramework.LogError("009", "TestMethod_DelegatePInvokeStdcall:The return value is wrong"); } if ('z' != p[0]) { bresult = false; TestFramework.LogError("010", "TestMethod_DelegatePInvokeStdcall:The value hasnt changed"); } } catch (Exception e) { bresult = false; TestFramework.LogError("e06", "Unexpected Exception" + e.ToString()); } return(bresult); }