[loader] Init MonoClass:sizes.element_size lazily (Fixes #43563) (#5559)
[mono.git] / mono / tests / pinvoke13.cs
1 //
2 // pinvoke13.cs
3 //
4 //   Tests for pinvoke name mangling
5 //
6 using System;
7 using System.Runtime.InteropServices;
8
9 public class Tests
10 {
11         /*
12          * These tests exercise the search order associated with the different charset values.
13          */
14
15         /* This should call NameManglingAnsi */
16         [DllImport("libtest", CharSet=CharSet.Ansi)]
17         private static extern int NameManglingAnsi (string data);
18
19         /* This should call NameManglingAnsi2A */
20         [DllImport ("libtest", CharSet=CharSet.Ansi)]
21         private static extern int NameManglingAnsi2 (string data);
22
23         /* This should call NameManglingUnicodeW */
24         [DllImport ("libtest", CharSet=CharSet.Unicode)]
25         private static extern int NameManglingUnicode (string data);
26
27         /* This should call NameManglingUnicode2 */
28         [DllImport ("libtest", CharSet=CharSet.Unicode)]
29         private static extern int NameManglingUnicode2 (string data);
30
31         /* This should call NameManglingAutoW under windows, and NameManglingAuto under unix */
32         [DllImport ("libtest", CharSet=CharSet.Auto)]
33         private static extern int NameManglingAuto (string s);
34
35         public static int Main (String[] args) {
36                 int res;
37
38                 res = NameManglingAnsi ("ABC");
39                 if (res != 198)
40                         return 1;
41                 res = NameManglingAnsi2 ("ABC");
42                 if (res != 198)
43                         return 2;
44                 res = NameManglingUnicode ("ABC");
45                 if (res != 198)
46                         return 3;
47                 res = NameManglingUnicode2 ("ABC");
48                 if (res != 198)
49                         return 4;
50
51                 res = NameManglingAuto ("ABC");
52                 if (res != 0)
53                         return 5;
54                 
55                 return 0;
56         }
57 }
58