Пример #1
0
 // Return new InnerExplicit instance 
 public static InnerExplicit NewInnerExplicit(int f1, float f2, string f3)
 {
     InnerExplicit inner = new InnerExplicit();
     inner.f1 = f1;
     inner.f2 = f2;
     inner.f3 = f3;
     return inner;
 }
Пример #2
0
    // Return new InnerExplicit instance
    public static InnerExplicit NewInnerExplicit(int f1, float f2, string f3)
    {
        InnerExplicit inner = new InnerExplicit();

        inner.f1 = f1;
        inner.f2 = f2;
        inner.f3 = f3;
        return(inner);
    }
Пример #3
0
 public static bool TestMethod_DoCallBack_MarshalStructByVal_InnerExplicit_Stdcall(InnerExplicit inner2)
 {
     Console.WriteLine("Reverse,Pinvoke,By Val,Stdcall");
     InnerExplicit source_ie = new InnerExplicit();
     source_ie.f1 = 1;
     source_ie.f3 = "Native";
     Assert.True(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByVal_InnerExplicit_Stdcall"));
     //changed the value
     inner2.f1 = 1;
     inner2.f3 = "changed string";
     return true;
 }
Пример #4
0
    public static bool TestMethod_DoCallBack_MarshalStructByRef_InnerExplicit_Cdecl(ref InnerExplicit inner2)
    {
        Console.WriteLine("Reverse,Pinvoke,By Ref,Cdecl");
        InnerExplicit source_ie = new InnerExplicit();

        source_ie.f1 = 77;
        source_ie.f3 = "Native";
        Assert.IsTrue(Helper.ValidateInnerExplicit(source_ie, inner2, "TestMethod_DoCallBack_MarshalStructByRef_InnerExplicit_Cdecl"));
        //changed the value
        inner2.f1 = 1;
        inner2.f3 = "some string";
        return(true);
    }
Пример #5
0
 public static bool ValidateInnerExplicit(InnerExplicit inner1, InnerExplicit inner2, string methodName)
 {
     if (inner1.f1 != inner2.f1 || inner1.f2 != inner2.f2 || inner1.f3 != inner2.f3)
     {
         Console.WriteLine("\tFAILED! " + methodName + "did not receive result as expected.");
         Console.WriteLine("\tThe Actual is...");
         PrintInnerExplicit(inner1, inner1.ToString());
         Console.WriteLine("\tThe Expected is...");
         PrintInnerExplicit(inner2, inner2.ToString());
         return(false);
     }
     else
     {
         Console.WriteLine("\tPASSED!");
         return(true);
     }
 }
Пример #6
0
 public static bool ValidateInnerExplicit(InnerExplicit inner1, InnerExplicit inner2, string methodName)
 {
     if (inner1.f1 != inner2.f1 || inner1.f2 != inner2.f2 || inner1.f3 != inner2.f3)
     {
         Console.WriteLine("\tFAILED! " + methodName + "did not recieve result as expected.");
         Console.WriteLine("\tThe Actual is...");
         PrintInnerExplicit(inner1, inner1.ToString());
         Console.WriteLine("\tThe Expected is...");
         PrintInnerExplicit(inner2, inner2.ToString());
         return false;
     }
     else
     {
         Console.WriteLine("\tPASSED!");
         return true;
     }
 }
Пример #7
0
 //	Prints InnerExplicit  
 public static void PrintInnerExplicit(InnerExplicit inner, string name)
 {
     Console.WriteLine("\t{0}.f1 = {1}", name, inner.f1);
     Console.WriteLine("\t{0}.f2 = {1}", name, inner.f2);
     Console.WriteLine("\t{0}.f3 = {1}", name, inner.f3);
 }
Пример #8
0
 //	Prints InnerExplicit
 public static void PrintInnerExplicit(InnerExplicit inner, string name)
 {
     Console.WriteLine("\t{0}.f1 = {1}", name, inner.f1);
     Console.WriteLine("\t{0}.f2 = {1}", name, inner.f2);
     Console.WriteLine("\t{0}.f3 = {1}", name, inner.f3);
 }
Пример #9
0
    private static void MarshalStructAsParam_AsExpByRefOut(StructID id)
    {
        try
        {
            switch (id)
            {
                case StructID.INNER2Id:
                    INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
                    INNER2 changeINNER2 = Helper.NewINNER2(77, 77.0F, "changed string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutINNER2...");
                    if (!MarshalStructAsParam_AsExpByRefOutINNER2(out sourceINNER2))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutINNER2.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateINNER2(sourceINNER2, changeINNER2, "MarshalStructAsParam_AsExpByRefOutINNER2"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.InnerExplicitId:
                    InnerExplicit sourceInnerExplicit = new InnerExplicit();
                    sourceInnerExplicit.f1 = 1;
                    sourceInnerExplicit.f3 = "some string";
                    InnerExplicit changeInnerExplicit = new InnerExplicit();
                    changeInnerExplicit.f1 = 77;
                    changeInnerExplicit.f3 = "changed string";

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutInnerExplicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutInnerExplicit(out sourceInnerExplicit))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutInnerExplicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "MarshalStructAsParam_AsExpByRefOutInnerExplicit"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.InnerArrayExplicitId:
                    InnerArrayExplicit sourceInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
                    InnerArrayExplicit changeInnerArrayExplicit = Helper.NewInnerArrayExplicit(77, 77.0F, "change string1", "change string2");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit(out sourceInnerArrayExplicit))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.OUTER3Id:
                    OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
                    OUTER3 changeOUTER3 = Helper.NewOUTER3(77, 77.0F, "changed string", "changed string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutOUTER3...");
                    if (!MarshalStructAsParam_AsExpByRefOutOUTER3(out sourceOUTER3))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutOUTER3.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "MarshalStructAsParam_AsExpByRefOutOUTER3"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.UId:
                    U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
                    U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue, byte.MaxValue, sbyte.MinValue, long.MaxValue, ulong.MinValue, 64.0F, 6.4);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutU...");
                    if (!MarshalStructAsParam_AsExpByRefOutU(out sourceU))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutU.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateU(sourceU, changeU, "MarshalStructAsParam_AsExpByRefOutU"))
                    {
                        failures++;
                    }
                    break;   
                case StructID.ByteStructPack2ExplicitId:
                    ByteStructPack2Explicit source_bspe = Helper.NewByteStructPack2Explicit(32, 32);
                    ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit(out source_bspe))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit"))
                    {
                        failures++;
                    }
                    break; 
                case StructID.ShortStructPack4ExplicitId:
                    ShortStructPack4Explicit source_sspe = Helper.NewShortStructPack4Explicit(32, 32);
                    ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit(out source_sspe))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit"))
                    {
                        failures++;
                    }
                    break;
                case StructID.IntStructPack8ExplicitId:
                    IntStructPack8Explicit source_ispe = Helper.NewIntStructPack8Explicit(32, 32);
                    IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit(out source_ispe))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit"))
                    {
                        failures++;
                    }
                    break;
                case StructID.LongStructPack16ExplicitId:
                    LongStructPack16Explicit sourceLongStructPack16Explicit = Helper.NewLongStructPack16Explicit(32, 32);
                    LongStructPack16Explicit changeLongStructPack16Explicit = Helper.NewLongStructPack16Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit(out sourceLongStructPack16Explicit))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateLongStructPack16Explicit(sourceLongStructPack16Explicit, changeLongStructPack16Explicit, "MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit"))
                    {
                        failures++;
                    }
                    break;   
                default:
                    Console.WriteLine("\tThere is not the struct id");
                    failures++;
                    break;
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Unexpected Exception:" + e.ToString());
            failures++;
        }
    }
Пример #10
0
 static extern bool MarshalStructAsParam_AsExpByRefOutInnerExplicit(out InnerExplicit str1);
Пример #11
0
 static extern bool MarshalStructAsParam_AsExpByValInnerExplicit(InnerExplicit str1);
Пример #12
0
    private static void TestMethod_DelegatePInvoke_MarshalByRef_Cdecl(StructID structid)
    {
        Console.WriteLine("Delegate,Pinvoke,By Ref,Cdecl");

        switch (structid)
        {
        case StructID.INNER2Id:
            INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
            INNER2 changeINNER2 = Helper.NewINNER2(77, 77.0F, "changed string");
            DelegateCdeclByRef_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_INNER2(ref sourceINNER2));
            Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, changeINNER2, "Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr"));
            break;

        case StructID.InnerExplicitId:
            InnerExplicit sourceInnerExplicit = new InnerExplicit();
            sourceInnerExplicit.f1 = 1;
            sourceInnerExplicit.f3 = "some string";
            InnerExplicit changeInnerExplicit = new InnerExplicit();
            changeInnerExplicit.f1 = 77;
            changeInnerExplicit.f3 = "changed string";
            DelegateCdeclByRef_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_InnerExplicit(ref sourceInnerExplicit));
            Assert.IsTrue(Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr"));
            break;

        case StructID.InnerArrayExplicitId:
            InnerArrayExplicit sourceInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
            InnerArrayExplicit changeInnerArrayExplicit = Helper.NewInnerArrayExplicit(77, 77.0F, "change string1", "change string2");
            DelegateCdeclByRef_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_InnerArrayExplicit(ref sourceInnerArrayExplicit));
            Assert.IsTrue(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr"));
            break;

        case StructID.OUTER3Id:
            OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
            OUTER3 changeOUTER3 = Helper.NewOUTER3(77, 77.0F, "changed string", "changed string");
            DelegateCdeclByRef_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_OUTER3(ref sourceOUTER3));
            Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr"));
            break;

        case StructID.UId:
            U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
                                    byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
            U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue,
                                    byte.MaxValue, sbyte.MinValue, long.MaxValue, ulong.MinValue, 64.0F, 6.4);
            DelegateCdeclByRef_U caller_U = Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_U(ref sourceU));
            Assert.IsTrue(Helper.ValidateU(sourceU, changeU, "Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr"));
            break;

        case StructID.ByteStructPack2ExplicitId:
            ByteStructPack2Explicit source_bspe = Helper.NewByteStructPack2Explicit(32, 32);
            ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
            DelegateCdeclByRef_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_ByteStructPack2Explicit(ref source_bspe));
            Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr"));
            break;

        case StructID.ShortStructPack4ExplicitId:
            ShortStructPack4Explicit source_sspe = Helper.NewShortStructPack4Explicit(32, 32);
            ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
            DelegateCdeclByRef_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_ShortStructPack4Explicit(ref source_sspe));
            Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr"));
            break;

        case StructID.IntStructPack8ExplicitId:
            IntStructPack8Explicit source_ispe = Helper.NewIntStructPack8Explicit(32, 32);
            IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
            DelegateCdeclByRef_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_IntStructPack8Explicit(ref source_ispe));
            Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr"));
            break;

        case StructID.LongStructPack16ExplicitId:
            LongStructPack16Explicit source_lspe = Helper.NewLongStructPack16Explicit(32, 32);
            LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(64, 64);
            DelegateCdeclByRef_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_LongStructPack16Explicit(ref source_lspe));
            Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(source_lspe, change_lspe, "Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr"));
            break;

        default:
            Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
            break;
        }
    }
Пример #13
0
    private static void TestMethod_DelegatePInvoke_MarshalByVal_Stdcall(StructID structid)
    {
        Console.WriteLine("Delegate,Pinvoke,By Val,Stdcall");

        switch (structid)
        {
        case StructID.INNER2Id:
            INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
            INNER2 cloneINNER2  = Helper.NewINNER2(1, 1.0F, "some string");
            DelegateStdcallByVal_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr...");
            Assert.True(caller_INNER2(sourceINNER2));
            Assert.True(Helper.ValidateINNER2(sourceINNER2, cloneINNER2, "Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr"));
            break;

        case StructID.InnerExplicitId:
            InnerExplicit sourceInnerExplicit = new InnerExplicit();
            sourceInnerExplicit.f1 = 1;
            sourceInnerExplicit.f3 = "some string";
            InnerExplicit cloneInnerExplicit = new InnerExplicit();
            cloneInnerExplicit.f1 = 1;
            cloneInnerExplicit.f3 = "some string";
            DelegateStdcallByVal_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr...");
            Assert.True(caller_InnerExplicit(sourceInnerExplicit));
            Assert.True(Helper.ValidateInnerExplicit(sourceInnerExplicit, cloneInnerExplicit, "Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr"));
            break;

        case StructID.InnerArrayExplicitId:
            InnerArrayExplicit sourceInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
            InnerArrayExplicit cloneInnerArrayExplicit  = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
            DelegateStdcallByVal_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr...");
            Assert.True(caller_InnerArrayExplicit(sourceInnerArrayExplicit));
            Assert.True(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, cloneInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr"));
            break;

        case StructID.OUTER3Id:
            OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
            OUTER3 cloneOUTER3  = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
            DelegateStdcallByVal_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr...");
            Assert.True(caller_OUTER3(sourceOUTER3));
            Assert.True(Helper.ValidateOUTER3(sourceOUTER3, cloneOUTER3, "Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr"));
            break;

        case StructID.UId:
            U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
                                    byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
            U cloneU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
                                   byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
            DelegateStdcallByVal_U caller_U = Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr...");
            Assert.True(caller_U(sourceU));
            Assert.True(Helper.ValidateU(sourceU, cloneU, "Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr"));
            break;

        case StructID.ByteStructPack2ExplicitId:
            ByteStructPack2Explicit source_bspe = Helper.NewByteStructPack2Explicit(32, 32);
            ByteStructPack2Explicit clone_bspe  = Helper.NewByteStructPack2Explicit(32, 32);
            DelegateStdcallByVal_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_ByteStructPack2Explicit(source_bspe));
            Assert.True(Helper.ValidateByteStructPack2Explicit(source_bspe, clone_bspe, "Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr"));
            break;

        case StructID.ShortStructPack4ExplicitId:
            ShortStructPack4Explicit source_sspe = Helper.NewShortStructPack4Explicit(32, 32);
            ShortStructPack4Explicit clone_sspe  = Helper.NewShortStructPack4Explicit(32, 32);
            DelegateStdcallByVal_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_ShortStructPack4Explicit(source_sspe));
            Assert.True(Helper.ValidateShortStructPack4Explicit(source_sspe, clone_sspe, "Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr"));
            break;

        case StructID.IntStructPack8ExplicitId:
            IntStructPack8Explicit source_ispe = Helper.NewIntStructPack8Explicit(32, 32);
            IntStructPack8Explicit clone_ispe  = Helper.NewIntStructPack8Explicit(32, 32);
            DelegateStdcallByVal_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_IntStructPack8Explicit(source_ispe));
            Assert.True(Helper.ValidateIntStructPack8Explicit(source_ispe, clone_ispe, "Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr"));
            break;

        case StructID.LongStructPack16ExplicitId:
            LongStructPack16Explicit source_lspe = Helper.NewLongStructPack16Explicit(32, 32);
            LongStructPack16Explicit clone_lspe  = Helper.NewLongStructPack16Explicit(32, 32);
            DelegateStdcallByVal_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_LongStructPack16Explicit(source_lspe));
            Assert.True(Helper.ValidateLongStructPack16Explicit(source_lspe, clone_lspe, "Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr"));
            break;

        default:
            Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_Stdcall:The structid (Managed Side) is wrong");
            break;
        }
    }