public static Sharpen.INativeHandle GetPinnedPtr(int[] arg) { if (arg == null) { return null; } PinnedHandle pinned = new PinnedHandle(); Array_int_Struct obj = new Array_int_Struct(); obj._owner = 0x337b4904; obj.length = arg.Length; { pinned.handle_array_ptr = GCHandle.Alloc(arg, GCHandleType.Pinned); obj.ptr = pinned.handle_array_ptr.AddrOfPinnedObject(); } pinned.handle = GCHandle.Alloc(obj, GCHandleType.Pinned); pinned.ptr = pinned.handle.AddrOfPinnedObject(); return pinned; }
public static void MarshalIn(System.IntPtr ptr, int[] arg) { Array_int_Struct obj = new Array_int_Struct(); obj._owner = 0x972f3813; obj.length = arg.Length; { obj.ptr = ptr + XobotOS.Runtime.MarshalGlue.Array_int_Helper.NativeSize; Marshal.Copy(arg, 0, obj.ptr, arg.Length); } Marshal.StructureToPtr(obj, ptr, false); }