[2019-12] [threads] Add back mono_threads_attach_tools_thread as a public API (#18074)
[mono-project.git] / mono / tests / pinvoke13.cs
blobe3f5f5788c893033b23420dd2f3c6a2fbf5622de
1 //
2 // pinvoke13.cs
3 //
4 // Tests for pinvoke name mangling
5 //
6 using System;
7 using System.Runtime.InteropServices;
9 public class Tests
12 * These tests exercise the search order associated with the different charset values.
15 /* This should call NameManglingAnsi */
16 [DllImport("libtest", CharSet=CharSet.Ansi)]
17 private static extern int NameManglingAnsi (string data);
19 /* This should call NameManglingAnsi2A */
20 [DllImport ("libtest", CharSet=CharSet.Ansi)]
21 private static extern int NameManglingAnsi2 (string data);
23 /* This should call NameManglingUnicodeW */
24 [DllImport ("libtest", CharSet=CharSet.Unicode)]
25 private static extern int NameManglingUnicode (string data);
27 /* This should call NameManglingUnicode2 */
28 [DllImport ("libtest", CharSet=CharSet.Unicode)]
29 private static extern int NameManglingUnicode2 (string data);
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);
35 public static int Main (String[] args) {
36 int res;
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;
51 res = NameManglingAuto ("ABC");
52 if (res != 0)
53 return 5;
55 return 0;