public static void MarshalIn(System.IntPtr ptr, martin.Test.Foo[] arg) { Array_Foo_Struct obj = new Array_Foo_Struct(); obj._owner = 0x972f3813; obj.length = arg.Length; { obj.ptr = ptr + Array_Foo_Helper.NativeSize; System.IntPtr addr = obj.ptr; for (int i = 0; i < arg.Length; i++, addr += martin.Test.Foo.Foo_Helper.NativeSize) { martin.Test.Foo.Foo_Helper.MarshalIn(addr, arg[i]); } } Marshal.StructureToPtr(obj, ptr, false); }
public static void FreeManagedPtr_inner(System.IntPtr ptr) { Array_Foo_Struct obj = (Array_Foo_Struct)Marshal.PtrToStructure(ptr, typeof(Array_Foo_Struct )); if (obj._owner != 0x972f3813) { throw new System.InvalidOperationException(); } { System.IntPtr addr = obj.ptr; for (int i = 0; i < obj.length; i++, addr += martin.Test.Foo.Foo_Helper.NativeSize) { martin.Test.Foo.Foo_Helper.FreeManagedPtr_inner(addr); } } }
public static void MarshalOut(System.IntPtr ptr, martin.Test.Foo[] arg) { Array_Foo_Struct obj = (Array_Foo_Struct)Marshal.PtrToStructure(ptr, typeof(Array_Foo_Struct )); if (obj.length != arg.Length) { throw new System.InvalidOperationException(); } { System.IntPtr addr = obj.ptr; for (int i = 0; i < obj.length; i++, addr += martin.Test.Foo.Foo_Helper.NativeSize) { martin.Test.Foo.Foo_Helper.MarshalOut(addr, arg[i]); } } }
public static martin.Test.Foo[] NativeToManaged(System.IntPtr ptr) { if (ptr == System.IntPtr.Zero) { return(null); } Array_Foo_Struct obj = (Array_Foo_Struct)Marshal.PtrToStructure(ptr, typeof(Array_Foo_Struct )); martin.Test.Foo[] arg = new martin.Test.Foo[obj.length]; if (obj.length != arg.Length) { throw new System.InvalidOperationException(); } { System.IntPtr addr = obj.ptr; for (int i = 0; i < obj.length; i++, addr += martin.Test.Foo.Foo_Helper.NativeSize) { arg[i] = martin.Test.Foo.Foo_Helper.NativeToManaged(addr); } } return(arg); }