blob: 1001a86d96d396ffc0148a6facd6066b891053b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
using System;
using System.Runtime.InteropServices;
[module: DefaultCharSet (CharSet.Unicode)]
struct foo1
{
}
enum E
{
}
[StructLayout (LayoutKind.Sequential, CharSet = CharSet.Auto)]
struct foo2
{
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void D ();
class C
{
public class CC
{
}
}
class Program
{
[DllImport ("bah")]
public static extern void test ();
public static int Main ()
{
DllImportAttribute dia = Attribute.GetCustomAttribute (typeof (Program).GetMethod ("test"), typeof (DllImportAttribute)) as DllImportAttribute;
if (dia == null)
return 1;
if (dia.CharSet != CharSet.Unicode)
return 2;
if (!typeof (C).IsUnicodeClass)
return 3;
if (!typeof (C.CC).IsUnicodeClass)
return 4;
if (!typeof (D).IsUnicodeClass)
return 5;
var ufp = typeof (D).GetCustomAttributes (false)[0] as UnmanagedFunctionPointerAttribute;
if (ufp.CharSet != CharSet.Unicode)
return 51;
if (!typeof (E).IsUnicodeClass)
return 6;
if (!typeof (foo1).IsUnicodeClass)
return 7;
if (!typeof (foo2).IsAutoClass)
return 8;
return 0;
}
}
|