private static bool TestMethod_DelegatePInvokeCdecl() { TestFramework.BeginScenario("Delegate Pinvoke Cdecl"); bool breturn = true; try { DelegatePInvokeCdecl caller = MarshalRefInt_DelegatePInvoke_Cdecl(); int i = 10; if (!caller(ref i)) { breturn = false; TestFramework.LogError("007", "TestMethod_DelegatePInvokeCdecl:The return value is wrong(Managed Side)"); } if (iNative != i) { breturn = false; TestFramework.LogError("008", "TestMethod_DelegatePInvokeCdecl: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_DelegatePInvokeCdecl() { 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); } DelegatePInvokeCdecl caller = DelegatePinvoke_Cdecl(); if (!caller(ref p)) { bresult = false; TestFramework.LogError("007", "TestMethod_DelegatePInvokeCdecl:The return value is wrong"); } if ('z' != p[0]) { bresult = false; TestFramework.LogError("008", "TestMethod_DelegatePInvokeCdecl:The value hasnt changed"); } } catch (Exception e) { bresult = false; TestFramework.LogError("e05", "Unexpected Exception" + e.ToString()); } return(bresult); }