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); }
public static void FreeManagedPtr(System.IntPtr ptr) { if (ptr == System.IntPtr.Zero) { return; } Array_Foo_Helper.FreeManagedPtr_inner(ptr); Marshal.FreeHGlobal(ptr); }
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); }
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); }
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); }
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); } }
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); }