Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / marshal1.cs
1 using System;
2 using System.Runtime.InteropServices;
3
4 public class Test {
5
6         public static int Main () {
7                 byte [] bytesrc = new byte [20];
8                 byte [] bytedest = new byte [20];
9
10                 IntPtr dest = Marshal.AllocHGlobal (1024);
11                 
12                 bytesrc [2] = 2;
13                 bytesrc [11] = 11;              
14                 Marshal.Copy (bytesrc, 2, dest, 10);
15
16                 if (Marshal.ReadByte (dest, 0) != 2)
17                         return 1;
18                 if (Marshal.ReadByte (dest, 9) != 11)
19                         return 1;
20
21                 Marshal.Copy (dest, bytedest, 2, 10);
22
23                 if (bytedest [2] != 2)
24                         return 1;
25                 if (bytedest [11] != 11)
26                         return 1;               
27
28                 return 0;
29         }
30 }
31