[600] | 1 | typedef struct some_struct_pointer * PTYPE;
|
---|
| 2 |
|
---|
| 3 | /*
|
---|
| 4 | * Function and method declarations.
|
---|
| 5 | * Checks mangling.
|
---|
| 6 | */
|
---|
| 7 | /* No underscore, No mangling. */
|
---|
| 8 | void _Optlink CVoid(int a, int b, int c, int d);
|
---|
| 9 | void * _Optlink CPVoid(int a, int b, int c, int d);
|
---|
| 10 | int _Optlink CInt(int a, int b, int c, int d);
|
---|
| 11 | PTYPE _Optlink CPType(int a, int b, int c, int d);
|
---|
| 12 |
|
---|
| 13 | /*
|
---|
| 14 | * Typedefs.
|
---|
| 15 | * Checks that there is not warnings on these.
|
---|
| 16 | */
|
---|
| 17 | typedef void _Optlink Typedef1Void(int a, int b, int c, int d);
|
---|
| 18 | typedef void * _Optlink Typedef1PVoid(int a, int b, int c, int d);
|
---|
| 19 | typedef int _Optlink Typedef1Int(int a, int b, int c, int d);
|
---|
| 20 | typedef PTYPE _Optlink Typedef1PType(int a, int b, int c, int d);
|
---|
| 21 |
|
---|
| 22 | typedef void (_Optlink Typedef2Void)(int a, int b, int c, int d);
|
---|
| 23 | typedef void * (_Optlink Typedef2PVoid)(int a, int b, int c, int d);
|
---|
| 24 | typedef int (_Optlink Typedef2Int)(int a, int b, int c, int d);
|
---|
| 25 | typedef PTYPE (_Optlink Typedef2PType)(int a, int b, int c, int d);
|
---|
| 26 |
|
---|
| 27 | typedef void (* _Optlink PTypedef1Void)(int a, int b, int c, int d);
|
---|
| 28 | typedef void * (* _Optlink PTypedef1PVoid)(int a, int b, int c, int d);
|
---|
| 29 | typedef int (* _Optlink PTypedef1Int)(int a, int b, int c, int d);
|
---|
| 30 | typedef PTYPE (* _Optlink PTypedef1PType)(int a, int b, int c, int d);
|
---|
| 31 |
|
---|
| 32 | /* Alternate writing which should have the same effect I think... */
|
---|
| 33 | typedef void (_Optlink * PTypedef2Void)(int a, int b, int c, int d);
|
---|
| 34 | typedef void * (_Optlink * PTypedef2PVoid)(int a, int b, int c, int d);
|
---|
| 35 | typedef int (_Optlink * PTypedef2Int)(int a, int b, int c, int d);
|
---|
| 36 | typedef PTYPE (_Optlink * PTypedef2PType)(int a, int b, int c, int d);
|
---|
| 37 |
|
---|
| 38 |
|
---|
| 39 | /*
|
---|
| 40 | * Structures.
|
---|
| 41 | */
|
---|
| 42 | typedef struct VFT
|
---|
| 43 | {
|
---|
| 44 | void (_Optlink * PStructMemberVoid)(int a, int b, int c, int d);
|
---|
| 45 | void * (_Optlink * PStructMemberPVoid)(int a, int b, int c, int d);
|
---|
| 46 | int (_Optlink * PStructMemberInt)(int a, int b, int c, int d);
|
---|
| 47 | PTYPE (_Optlink * PStructMemberPType)(int a, int b, int c, int d);
|
---|
| 48 |
|
---|
| 49 | /* Alternate writing which should have the same effect I think... */
|
---|
| 50 | void (_Optlink * PStructMember2Void)(int a, int b, int c, int d);
|
---|
| 51 | void * (_Optlink * PStructMember2PVoid)(int a, int b, int c, int d);
|
---|
| 52 | int (_Optlink * PStructMember2Int)(int a, int b, int c, int d);
|
---|
| 53 | PTYPE (_Optlink * PStructMember2PType)(int a, int b, int c, int d);
|
---|
| 54 |
|
---|
| 55 | } VFT, *PVFT;
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | int DoC(int a, int b, int c, int d)
|
---|
| 59 | {
|
---|
| 60 | static VFT vft = {CVoid, CPVoid, CInt, CPType,
|
---|
| 61 | CVoid, CPVoid, CInt, CPType};
|
---|
| 62 |
|
---|
| 63 | static Typedef1Void * pfnTypedef1Void = CVoid;
|
---|
| 64 | static Typedef1PVoid * pfnTypedef1PVoid = CPVoid;
|
---|
| 65 | static Typedef1Int * pfnTypedef1Int = CInt;
|
---|
| 66 | static Typedef1PType * pfnTypedef1PType = CPType;
|
---|
| 67 |
|
---|
| 68 | static Typedef2Void * pfnTypedef2Void = CVoid;
|
---|
| 69 | static Typedef2PVoid * pfnTypedef2PVoid = CPVoid;
|
---|
| 70 | static Typedef2Int * pfnTypedef2Int = CInt;
|
---|
| 71 | static Typedef2PType * pfnTypedef2PType = CPType;
|
---|
| 72 |
|
---|
| 73 | static PTypedef1Void pfnPTypedef1Void = CVoid;
|
---|
| 74 | static PTypedef1PVoid pfnPTypedef1PVoid = CPVoid;
|
---|
| 75 | static PTypedef1Int pfnPTypedef1Int = CInt;
|
---|
| 76 | static PTypedef1PType pfnPTypedef1PType = CPType;
|
---|
| 77 |
|
---|
| 78 | static PTypedef2Void pfnPTypedef2Void = CVoid;
|
---|
| 79 | static PTypedef2PVoid pfnPTypedef2PVoid = CPVoid;
|
---|
| 80 | static PTypedef2Int pfnPTypedef2Int = CInt;
|
---|
| 81 | static PTypedef2PType pfnPTypedef2PType = CPType;
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | /* extern functions */
|
---|
| 85 | CVoid(1,2,3,4);
|
---|
| 86 | CPVoid(1,2,3,4);
|
---|
| 87 | CInt(1,2,3,4);
|
---|
| 88 | CPType(1,2,3,4);
|
---|
| 89 |
|
---|
| 90 | /* typedefs */
|
---|
| 91 | pfnTypedef1Void(1,2,3,4);
|
---|
| 92 | pfnTypedef1PVoid(1,2,3,4);
|
---|
| 93 | pfnTypedef1Int(1,2,3,4);
|
---|
| 94 | pfnTypedef1PType(1,2,3,4);
|
---|
| 95 |
|
---|
| 96 | pfnTypedef2Void(1,2,3,4);
|
---|
| 97 | pfnTypedef2PVoid(1,2,3,4);
|
---|
| 98 | pfnTypedef2Int(1,2,3,4);
|
---|
| 99 | pfnTypedef2PType(1,2,3,4);
|
---|
| 100 |
|
---|
| 101 | pfnPTypedef1Void(1,2,3,4);
|
---|
| 102 | pfnPTypedef1PVoid(1,2,3,4);
|
---|
| 103 | pfnPTypedef1Int(1,2,3,4);
|
---|
| 104 | pfnPTypedef1PType(1,2,3,4);
|
---|
| 105 |
|
---|
| 106 | pfnPTypedef2Void(1,2,3,4);
|
---|
| 107 | pfnPTypedef2PVoid(1,2,3,4);
|
---|
| 108 | pfnPTypedef2Int(1,2,3,4);
|
---|
| 109 | pfnPTypedef2PType(1,2,3,4);
|
---|
| 110 |
|
---|
| 111 |
|
---|
| 112 | /* structs */
|
---|
| 113 | vft.PStructMemberVoid(1,2,3,4);
|
---|
| 114 | vft.PStructMemberPVoid(1,2,3,4);
|
---|
| 115 | vft.PStructMemberInt(1,2,3,4);
|
---|
| 116 | vft.PStructMemberPType(1,2,3,4);
|
---|
| 117 |
|
---|
| 118 | vft.PStructMember2Void(1,2,3,4);
|
---|
| 119 | vft.PStructMember2PVoid(1,2,3,4);
|
---|
| 120 | vft.PStructMember2Int(1,2,3,4);
|
---|
| 121 | vft.PStructMember2PType(1,2,3,4);
|
---|
| 122 |
|
---|
| 123 | return 0;
|
---|
| 124 | }
|
---|
| 125 |
|
---|