Exemple #1
0
                public static void MarshalOut(System.IntPtr ptr, martin.Test.Complex arg)
                {
                    Complex_Struct obj = (Complex_Struct)Marshal.PtrToStructure(ptr, typeof(Complex_Struct
                                                                                            ));

                    arg.foo = Array_Foo_Helper.NativeToManaged(obj.foo);
                    arg.str = XobotOS.Runtime.MarshalGlue.String_Helper.NativeToManaged(obj.str);
                }
Exemple #2
0
 public static void FreeManagedPtr(System.IntPtr ptr)
 {
     if (ptr == System.IntPtr.Zero)
     {
         return;
     }
     Array_Foo_Helper.FreeManagedPtr_inner(ptr);
     Marshal.FreeHGlobal(ptr);
 }
Exemple #3
0
                public static void MarshalIn(System.IntPtr ptr, martin.Test.Complex arg)
                {
                    Complex_Struct obj = new Complex_Struct();

                    obj._owner = 0x972f3813;
                    obj.foo    = Array_Foo_Helper.ManagedToNative(arg.foo);
                    obj.str    = XobotOS.Runtime.MarshalGlue.String_Helper.ManagedToNative(arg.str);
                    Marshal.StructureToPtr(obj, ptr, false);
                }
Exemple #4
0
 public static System.IntPtr ManagedToNative(martin.Test.Foo[] arg)
 {
     if (arg == null)
     {
         return(System.IntPtr.Zero);
     }
     System.IntPtr ptr = Marshal.AllocHGlobal(Array_Foo_Helper.NativeSize + martin.Test.Foo
                                              .Foo_Helper.NativeSize * arg.Length);
     Array_Foo_Helper.MarshalIn(ptr, arg);
     return(ptr);
 }
Exemple #5
0
                public static void FreeManagedPtr_inner(System.IntPtr ptr)
                {
                    Complex_Struct obj = (Complex_Struct)Marshal.PtrToStructure(ptr, typeof(Complex_Struct
                                                                                            ));

                    if (obj._owner != 0x972f3813)
                    {
                        throw new System.InvalidOperationException();
                    }
                    Array_Foo_Helper.FreeManagedPtr(obj.foo);
                    XobotOS.Runtime.MarshalGlue.String_Helper.FreeManagedPtr(obj.str);
                }
Exemple #6
0
 internal static void bar(martin.Test.Foo[] arg)
 {
     System.IntPtr arg_ptr = System.IntPtr.Zero;
     try
     {
         arg_ptr = Array_Foo_Helper.ManagedToNative(arg);
         libxobotos_Test_bar(arg_ptr);
     }
     finally
     {
         Array_Foo_Helper.FreeManagedPtr(arg_ptr);
     }
 }
Exemple #7
0
                public static martin.Test.Complex NativeToManaged(System.IntPtr ptr)
                {
                    if (ptr == System.IntPtr.Zero)
                    {
                        return(null);
                    }
                    Complex_Struct obj = (Complex_Struct)Marshal.PtrToStructure(ptr, typeof(Complex_Struct
                                                                                            ));

                    martin.Test.Complex arg = new martin.Test.Complex();
                    arg.foo = Array_Foo_Helper.NativeToManaged(obj.foo);
                    arg.str = XobotOS.Runtime.MarshalGlue.String_Helper.NativeToManaged(obj.str);
                    return(arg);
                }