tests.rtti.invoketypes.pas 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186
  1. unit tests.rtti.invoketypes;
  2. {$ifdef fpc}
  3. {$mode ObjFPC}{$H+}
  4. {$endif}
  5. interface
  6. uses
  7. Classes, SysUtils, RTTI;
  8. const
  9. SingleArg1: Single = 1.23;
  10. SingleArg2In: Single = 3.21;
  11. SingleArg2Out: Single = 2.34;
  12. SingleArg3Out: Single = 9.87;
  13. SingleArg4: Single = 7.89;
  14. SingleRes: Single = 4.32;
  15. SingleAddArg1 = Single(1.23);
  16. SingleAddArg2 = Single(2.34);
  17. SingleAddArg3 = Single(3.45);
  18. SingleAddArg4 = Single(4.56);
  19. SingleAddArg5 = Single(5.67);
  20. SingleAddArg6 = Single(9.87);
  21. SingleAddArg7 = Single(8.76);
  22. SingleAddArg8 = Single(7.65);
  23. SingleAddArg9 = Single(6.54);
  24. SingleAddArg10 = Single(5.43);
  25. SingleAddRes = SingleAddArg1 + SingleAddArg2 + SingleAddArg3 + SingleAddArg4 + SingleAddArg5 +
  26. SingleAddArg6 + SingleAddArg7 + SingleAddArg8 + SingleAddArg9 + SingleAddArg10;
  27. DoubleArg1: Double = 1.23;
  28. DoubleArg2In: Double = 3.21;
  29. DoubleArg2Out: Double = 2.34;
  30. DoubleArg3Out: Double = 9.87;
  31. DoubleArg4: Double = 7.89;
  32. DoubleRes: Double = 4.32;
  33. DoubleAddArg1 = Double(1.23);
  34. DoubleAddArg2 = Double(2.34);
  35. DoubleAddArg3 = Double(3.45);
  36. DoubleAddArg4 = Double(4.56);
  37. DoubleAddArg5 = Double(5.67);
  38. DoubleAddArg6 = Double(9.87);
  39. DoubleAddArg7 = Double(8.76);
  40. DoubleAddArg8 = Double(7.65);
  41. DoubleAddArg9 = Double(6.54);
  42. DoubleAddArg10 = Double(5.43);
  43. DoubleAddRes = DoubleAddArg1 + DoubleAddArg2 + DoubleAddArg3 + DoubleAddArg4 + DoubleAddArg5 +
  44. DoubleAddArg6 + DoubleAddArg7 + DoubleAddArg8 + DoubleAddArg9 + DoubleAddArg10;
  45. ExtendedArg1: Extended = 1.23;
  46. ExtendedArg2In: Extended = 3.21;
  47. ExtendedArg2Out: Extended = 2.34;
  48. ExtendedArg3Out: Extended = 9.87;
  49. ExtendedArg4: Extended = 7.89;
  50. ExtendedRes: Extended = 4.32;
  51. ExtendedAddArg1 = Extended(1.23);
  52. ExtendedAddArg2 = Extended(2.34);
  53. ExtendedAddArg3 = Extended(3.45);
  54. ExtendedAddArg4 = Extended(4.56);
  55. ExtendedAddArg5 = Extended(5.67);
  56. ExtendedAddArg6 = Extended(9.87);
  57. ExtendedAddArg7 = Extended(8.76);
  58. ExtendedAddArg8 = Extended(7.65);
  59. ExtendedAddArg9 = Extended(6.54);
  60. ExtendedAddArg10 = Extended(5.43);
  61. ExtendedAddRes = ExtendedAddArg1 + ExtendedAddArg2 + ExtendedAddArg3 + ExtendedAddArg4 + ExtendedAddArg5 +
  62. ExtendedAddArg6 + ExtendedAddArg7 + ExtendedAddArg8 + ExtendedAddArg9 + ExtendedAddArg10;
  63. CurrencyArg1: Currency = 1.23;
  64. CurrencyArg2In: Currency = 3.21;
  65. CurrencyArg2Out: Currency = 2.34;
  66. CurrencyArg3Out: Currency = 9.87;
  67. CurrencyArg4: Currency = 7.89;
  68. CurrencyRes: Currency = 4.32;
  69. CurrencyAddArg1 = Currency(1.23);
  70. CurrencyAddArg2 = Currency(2.34);
  71. CurrencyAddArg3 = Currency(3.45);
  72. CurrencyAddArg4 = Currency(4.56);
  73. CurrencyAddArg5 = Currency(5.67);
  74. CurrencyAddArg6 = Currency(9.87);
  75. CurrencyAddArg7 = Currency(8.76);
  76. CurrencyAddArg8 = Currency(7.65);
  77. CurrencyAddArg9 = Currency(6.54);
  78. CurrencyAddArg10 = Currency(5.43);
  79. CurrencyAddRes = CurrencyAddArg1 + CurrencyAddArg2 + CurrencyAddArg3 + CurrencyAddArg4 + CurrencyAddArg5 +
  80. CurrencyAddArg6 + CurrencyAddArg7 + CurrencyAddArg8 + CurrencyAddArg9 + CurrencyAddArg10;
  81. CompArg1: Comp = 123;
  82. CompArg2In: Comp = 321;
  83. CompArg2Out: Comp = 234;
  84. CompArg3Out: Comp = 987;
  85. CompArg4: Comp = 789;
  86. CompRes: Comp = 432;
  87. CompAddArg1 = Comp(123);
  88. CompAddArg2 = Comp(234);
  89. CompAddArg3 = Comp(345);
  90. CompAddArg4 = Comp(456);
  91. CompAddArg5 = Comp(567);
  92. CompAddArg6 = Comp(987);
  93. CompAddArg7 = Comp(876);
  94. CompAddArg8 = Comp(765);
  95. CompAddArg9 = Comp(654);
  96. CompAddArg10 = Comp(543);
  97. CompAddRes = CompAddArg1 + CompAddArg2 + CompAddArg3 + CompAddArg4 + CompAddArg5 +
  98. CompAddArg6 + CompAddArg7 + CompAddArg8 + CompAddArg9 + CompAddArg10;
  99. type
  100. TTestRecord1 = packed record
  101. b: array[0..0] of Byte;
  102. end;
  103. TTestRecord2 = packed record
  104. b: array[0..1] of Byte;
  105. end;
  106. TTestRecord3 = packed record
  107. b: array[0..2] of Byte;
  108. end;
  109. TTestRecord4 = packed record
  110. b: array[0..3] of Byte;
  111. end;
  112. TTestRecord5 = packed record
  113. b: array[0..4] of Byte;
  114. end;
  115. TTestRecord6 = packed record
  116. b: array[0..5] of Byte;
  117. end;
  118. TTestRecord7 = packed record
  119. b: array[0..6] of Byte;
  120. end;
  121. TTestRecord8 = packed record
  122. b: array[0..7] of Byte;
  123. end;
  124. TTestRecord9 = packed record
  125. b: array[0..8] of Byte;
  126. end;
  127. TTestRecord10 = packed record
  128. b: array[0..9] of Byte;
  129. end;
  130. {$M+}
  131. ITestInterface = interface
  132. procedure Test1;
  133. function Test2: SizeInt;
  134. function Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  135. procedure Test4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  136. function Test5: AnsiString;
  137. function Test6: UnicodeString;
  138. function Test7: WideString;
  139. function Test8: ShortString;
  140. procedure Test9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  141. procedure Test10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  142. procedure Test11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  143. procedure Test12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  144. function Test13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  145. function Test14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  146. function Test15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  147. function Test16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  148. function Test17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  149. function Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  150. function Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  151. function Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  152. function Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  153. function Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  154. function Test23(aArg1 : Variant) : AnsiString;
  155. function TestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  156. function TestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  157. function TestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  158. function TestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  159. function TestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  160. function TestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  161. function TestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  162. function TestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  163. function TestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  164. function TestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  165. procedure TestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  166. end;
  167. {$M-}
  168. { TTestInterfaceClass }
  169. TTestInterfaceClass = class(TInterfacedObject, ITestInterface)
  170. public
  171. procedure Test1;
  172. function Test2: SizeInt;
  173. function Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  174. procedure Test4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  175. function Test5: AnsiString;
  176. function Test6: UnicodeString;
  177. function Test7: WideString;
  178. function Test8: ShortString;
  179. procedure Test9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  180. procedure Test10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  181. procedure Test11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  182. procedure Test12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  183. function Test13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  184. function Test14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  185. function Test15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  186. function Test16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  187. function Test17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  188. function Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  189. function Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  190. function Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  191. function Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  192. function Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  193. function Test23(aArg1 : Variant) : AnsiString;
  194. function TestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  195. function TestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  196. function TestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  197. function TestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  198. function TestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  199. function TestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  200. function TestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  201. function TestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  202. function TestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  203. function TestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  204. procedure TestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  205. public
  206. InputArgs: array of TValue;
  207. OutputArgs: array of TValue;
  208. ExpectedArgs: array of TValue;
  209. OutArgs: array of TValue;
  210. ResultValue: TValue;
  211. CalledMethod: SizeInt;
  212. InOutMapping: array of SizeInt;
  213. procedure Reset;
  214. function DoAddRef : longint;
  215. function DoRelease : longint;
  216. Destructor Destroy; override;
  217. public class var
  218. ProcVarInst: TTestInterfaceClass;
  219. ProcVarRecInst: TTestInterfaceClass;
  220. public const
  221. RecSizeMarker = SizeInt($80000000);
  222. end;
  223. ITestMethodCall = interface
  224. Function Test : String;
  225. end;
  226. {$RTTI EXPLICIT METHODS[vcPrivate,vcProtected,vcPublic,vcPublished]}
  227. { TTestParent }
  228. TTestParent = class
  229. function DoTest : String; virtual;
  230. end;
  231. TTest = Class(TInterfacedObject,ITestMethodCall)
  232. FTestCalled : Boolean;
  233. Function Test : String;
  234. end;
  235. { TTestConstructorCall }
  236. TTestConstructorCall = class(TTestParent)
  237. Private
  238. FTest : ITestMethodCall;
  239. Public
  240. constructor Create({[QueryParam]} aTest: ITestMethodCall);
  241. function DoTest : String; override;
  242. end;
  243. type
  244. TEnum1 = (en1_1, en1_2);
  245. TEnum2 = (en2_1);
  246. TEnum3 = en1_1..en1_1;
  247. { TTestInvokeCast }
  248. TTestInvokeCast = class(TPersistent)
  249. published
  250. function Test(Arg: Single): Double;
  251. procedure Test2(var Arg: Single);
  252. procedure Test3(Arg: TEnum1);
  253. function Test4(Arg: UInt8): UInt8;
  254. end;
  255. TMethodTest1 = procedure of object;
  256. TMethodTest2 = function: SizeInt of object;
  257. TMethodTest3 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt of object;
  258. TMethodTest4 = procedure(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString) of object;
  259. TMethodTest5 = function: AnsiString of object;
  260. TMethodTest6 = function: UnicodeString of object;
  261. TMethodTest7 = function: WideString of object;
  262. TMethodTest8 = function: ShortString of object;
  263. TMethodTest9 = procedure(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt) of object;
  264. TMethodTest10 = procedure(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString) of object;
  265. TMethodTest11 = procedure(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString) of object;
  266. TMethodTest12 = procedure(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt) of object;
  267. TMethodTest13 = function(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single of object;
  268. TMethodTest14 = function(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double of object;
  269. TMethodTest15 = function(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended of object;
  270. TMethodTest16 = function(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp of object;
  271. TMethodTest17 = function(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency of object;
  272. TMethodTest18 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single of object;
  273. TMethodTest19 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double of object;
  274. TMethodTest20 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended of object;
  275. TMethodTest21 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp of object;
  276. TMethodTest22 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency of object;
  277. TMethodTestRecSize1 = function(aArg1: TTestRecord1): TTestRecord1 of object;
  278. TMethodTestRecSize2 = function(aArg1: TTestRecord2): TTestRecord2 of object;
  279. TMethodTestRecSize3 = function(aArg1: TTestRecord3): TTestRecord3 of object;
  280. TMethodTestRecSize4 = function(aArg1: TTestRecord4): TTestRecord4 of object;
  281. TMethodTestRecSize5 = function(aArg1: TTestRecord5): TTestRecord5 of object;
  282. TMethodTestRecSize6 = function(aArg1: TTestRecord6): TTestRecord6 of object;
  283. TMethodTestRecSize7 = function(aArg1: TTestRecord7): TTestRecord7 of object;
  284. TMethodTestRecSize8 = function(aArg1: TTestRecord8): TTestRecord8 of object;
  285. TMethodTestRecSize9 = function(aArg1: TTestRecord9): TTestRecord9 of object;
  286. TMethodTestRecSize10 = function(aArg1: TTestRecord10): TTestRecord10 of object;
  287. TMethodTestUntyped = procedure(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4) of object;
  288. TProcVarTest1 = procedure;
  289. TProcVarTest2 = function: SizeInt;
  290. TProcVarTest3 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  291. TProcVarTest4 = procedure(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  292. TProcVarTest5 = function: AnsiString;
  293. TProcVarTest6 = function: UnicodeString;
  294. TProcVarTest7 = function: WideString;
  295. TProcVarTest8 = function: ShortString;
  296. TProcVarTest9 = procedure(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  297. TProcVarTest10 = procedure(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  298. TProcVarTest11 = procedure(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  299. TProcVarTest12 = procedure(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  300. TProcVarTest13 = function(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  301. TProcVarTest14 = function(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  302. TProcVarTest15 = function(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  303. TProcVarTest16 = function(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  304. TProcVarTest17 = function(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  305. TProcVarTest18 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  306. TProcVarTest19 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  307. TProcVarTest20 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  308. TProcVarTest21 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  309. TProcVarTest22 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  310. TProcVarTestRecSize1 = function(aArg1: TTestRecord1): TTestRecord1;
  311. TProcVarTestRecSize2 = function(aArg1: TTestRecord2): TTestRecord2;
  312. TProcVarTestRecSize3 = function(aArg1: TTestRecord3): TTestRecord3;
  313. TProcVarTestRecSize4 = function(aArg1: TTestRecord4): TTestRecord4;
  314. TProcVarTestRecSize5 = function(aArg1: TTestRecord5): TTestRecord5;
  315. TProcVarTestRecSize6 = function(aArg1: TTestRecord6): TTestRecord6;
  316. TProcVarTestRecSize7 = function(aArg1: TTestRecord7): TTestRecord7;
  317. TProcVarTestRecSize8 = function(aArg1: TTestRecord8): TTestRecord8;
  318. TProcVarTestRecSize9 = function(aArg1: TTestRecord9): TTestRecord9;
  319. TProcVarTestRecSize10 = function(aArg1: TTestRecord10): TTestRecord10;
  320. TProcVarTestUntyped = procedure(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  321. procedure ProcTest1;
  322. function ProcTest2: SizeInt;
  323. function ProcTest3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  324. procedure ProcTest4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  325. function ProcTest5: AnsiString;
  326. function ProcTest6: UnicodeString;
  327. function ProcTest7: WideString;
  328. function ProcTest8: ShortString;
  329. procedure ProcTest9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  330. procedure ProcTest10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  331. procedure ProcTest11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  332. procedure ProcTest12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  333. function ProcTest13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  334. function ProcTest14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  335. function ProcTest15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  336. function ProcTest16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  337. function ProcTest17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  338. function ProcTest18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  339. function ProcTest19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  340. function ProcTest20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  341. function ProcTest21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  342. function ProcTest22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  343. function ProcTestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  344. function ProcTestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  345. function ProcTestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  346. function ProcTestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  347. function ProcTestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  348. function ProcTestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  349. function ProcTestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  350. function ProcTestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  351. function ProcTestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  352. function ProcTestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  353. procedure ProcTestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  354. implementation
  355. procedure TTestInterfaceClass.Test1;
  356. begin
  357. SetLength(InputArgs, 0);
  358. SetLength(OutputArgs, 0);
  359. ResultValue := TValue.Empty;
  360. CalledMethod := 1;
  361. end;
  362. function TTestInterfaceClass.Test2: SizeInt;
  363. begin
  364. SetLength(InputArgs, 0);
  365. SetLength(OutputArgs, 0);
  366. Result := 42;
  367. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  368. CalledMethod := 2;
  369. end;
  370. function TTestInterfaceClass.Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  371. begin
  372. SetLength(InputArgs, 10);
  373. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  374. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  375. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  376. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  377. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  378. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  379. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  380. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  381. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  382. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  383. SetLength(OutputArgs, 0);
  384. Result := 42;
  385. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  386. CalledMethod := 3;
  387. end;
  388. procedure TTestInterfaceClass.Test4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  389. begin
  390. SetLength(InputArgs, 4);
  391. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  392. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  393. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  394. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  395. SetLength(OutputArgs, 0);
  396. ResultValue := TValue.Empty;
  397. CalledMethod := 4;
  398. end;
  399. function TTestInterfaceClass.Test5: AnsiString;
  400. begin
  401. SetLength(InputArgs, 0);
  402. SetLength(OutputArgs, 0);
  403. Result := 'Hello World';
  404. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  405. CalledMethod := 5;
  406. end;
  407. function TTestInterfaceClass.Test6: UnicodeString;
  408. begin
  409. SetLength(InputArgs, 0);
  410. SetLength(OutputArgs, 0);
  411. Result := 'Hello World';
  412. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  413. CalledMethod := 6;
  414. end;
  415. function TTestInterfaceClass.Test7: WideString;
  416. begin
  417. SetLength(InputArgs, 0);
  418. SetLength(OutputArgs, 0);
  419. Result := 'Hello World';
  420. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  421. CalledMethod := 7;
  422. end;
  423. function TTestInterfaceClass.Test8: ShortString;
  424. begin
  425. SetLength(InputArgs, 0);
  426. SetLength(OutputArgs, 0);
  427. Result := 'Hello World';
  428. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  429. CalledMethod := 8;
  430. end;
  431. procedure TTestInterfaceClass.Test9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  432. begin
  433. SetLength(InputArgs, 4);
  434. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  435. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  436. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  437. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  438. aArg2 := $1234;
  439. aArg3 := $5678;
  440. SetLength(OutputArgs, 2);
  441. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  442. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  443. SetLength(InOutMapping, 2);
  444. InOutMapping[0] := 1;
  445. InOutMapping[1] := 2;
  446. ResultValue := TValue.Empty;
  447. CalledMethod := 9;
  448. end;
  449. procedure TTestInterfaceClass.Test10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  450. begin
  451. SetLength(InputArgs, 4);
  452. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  453. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  454. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  455. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  456. aArg2 := 'Foo';
  457. aArg3 := 'Bar';
  458. SetLength(OutputArgs, 2);
  459. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  460. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  461. SetLength(InOutMapping, 2);
  462. InOutMapping[0] := 1;
  463. InOutMapping[1] := 2;
  464. ResultValue := TValue.Empty;
  465. CalledMethod := 10;
  466. end;
  467. procedure TTestInterfaceClass.Test11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  468. begin
  469. SetLength(InputArgs, 4);
  470. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  471. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  472. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  473. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  474. aArg2 := 'Foo';
  475. aArg3 := 'Bar';
  476. SetLength(OutputArgs, 2);
  477. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  478. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  479. SetLength(InOutMapping, 2);
  480. InOutMapping[0] := 1;
  481. InOutMapping[1] := 2;
  482. ResultValue := TValue.Empty;
  483. CalledMethod := 11;
  484. end;
  485. procedure TTestInterfaceClass.Test12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  486. {$ifdef fpc}
  487. var
  488. i: SizeInt;
  489. start: SizeInt;
  490. {$endif}
  491. begin
  492. {$ifdef fpc}
  493. SetLength(InputArgs, 4);
  494. InputArgs[0] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg1);
  495. InputArgs[1] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg2);
  496. InputArgs[2] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg3);
  497. InputArgs[3] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg4);
  498. SetLength(OutputArgs, 2);
  499. start := $4321;
  500. for i := 0 to High(aArg2) do
  501. aArg2[i] := start + i;
  502. start := $9876;
  503. for i := 0 to High(aArg3) do
  504. aArg3[i] := start + i;
  505. OutputArgs[0] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg2);
  506. OutputArgs[1] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg3);
  507. SetLength(InOutMapping, 2);
  508. InOutMapping[0] := 1;
  509. InOutMapping[1] := 2;
  510. ResultValue := TValue.Empty;
  511. CalledMethod := 12;
  512. {$endif}
  513. end;
  514. function TTestInterfaceClass.Test13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  515. begin
  516. SetLength(InputArgs, 4);
  517. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  518. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  519. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  520. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  521. aArg2 := SingleArg2Out;
  522. aArg3 := SingleArg3Out;
  523. SetLength(OutputArgs, 2);
  524. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  525. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  526. SetLength(InOutMapping, 2);
  527. InOutMapping[0] := 1;
  528. InOutMapping[1] := 2;
  529. Result := SingleRes;
  530. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  531. CalledMethod := 13;
  532. end;
  533. function TTestInterfaceClass.Test14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  534. begin
  535. SetLength(InputArgs, 4);
  536. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  537. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  538. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  539. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  540. aArg2 := DoubleArg2Out;
  541. aArg3 := DoubleArg3Out;
  542. SetLength(OutputArgs, 2);
  543. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  544. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  545. SetLength(InOutMapping, 2);
  546. InOutMapping[0] := 1;
  547. InOutMapping[1] := 2;
  548. Result := DoubleRes;
  549. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  550. CalledMethod := 14;
  551. end;
  552. function TTestInterfaceClass.Test15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  553. begin
  554. SetLength(InputArgs, 4);
  555. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  556. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  557. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  558. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  559. aArg2 := ExtendedArg2Out;
  560. aArg3 := ExtendedArg3Out;
  561. SetLength(OutputArgs, 2);
  562. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  563. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  564. SetLength(InOutMapping, 2);
  565. InOutMapping[0] := 1;
  566. InOutMapping[1] := 2;
  567. Result := ExtendedRes;
  568. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  569. CalledMethod := 15;
  570. end;
  571. function TTestInterfaceClass.Test16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  572. begin
  573. SetLength(InputArgs, 4);
  574. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  575. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  576. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  577. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  578. aArg2 := CompArg2Out;
  579. aArg3 := CompArg3Out;
  580. SetLength(OutputArgs, 2);
  581. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  582. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  583. SetLength(InOutMapping, 2);
  584. InOutMapping[0] := 1;
  585. InOutMapping[1] := 2;
  586. Result := CompRes;
  587. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  588. CalledMethod := 16;
  589. end;
  590. function TTestInterfaceClass.Test17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  591. begin
  592. SetLength(InputArgs, 4);
  593. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  594. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  595. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  596. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  597. aArg2 := CurrencyArg2Out;
  598. aArg3 := CurrencyArg3Out;
  599. SetLength(OutputArgs, 2);
  600. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  601. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  602. SetLength(InOutMapping, 2);
  603. InOutMapping[0] := 1;
  604. InOutMapping[1] := 2;
  605. Result := CurrencyRes;
  606. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  607. CalledMethod := 17;
  608. end;
  609. function TTestInterfaceClass.Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  610. begin
  611. SetLength(InputArgs, 10);
  612. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  613. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  614. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  615. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  616. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  617. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  618. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  619. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  620. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  621. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  622. SetLength(OutputArgs, 0);
  623. SetLength(InOutMapping, 0);
  624. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  625. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  626. CalledMethod := 18;
  627. end;
  628. function TTestInterfaceClass.Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  629. begin
  630. SetLength(InputArgs, 10);
  631. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  632. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  633. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  634. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  635. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  636. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  637. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  638. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  639. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  640. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  641. SetLength(OutputArgs, 0);
  642. SetLength(InOutMapping, 0);
  643. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  644. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  645. CalledMethod := 19;
  646. end;
  647. function TTestInterfaceClass.Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  648. begin
  649. SetLength(InputArgs, 10);
  650. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  651. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  652. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  653. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  654. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  655. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  656. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  657. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  658. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  659. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  660. SetLength(OutputArgs, 0);
  661. SetLength(InOutMapping, 0);
  662. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  663. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  664. CalledMethod := 20;
  665. end;
  666. function TTestInterfaceClass.Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  667. begin
  668. SetLength(InputArgs, 10);
  669. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  670. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  671. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  672. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  673. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  674. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  675. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  676. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  677. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  678. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  679. SetLength(OutputArgs, 0);
  680. SetLength(InOutMapping, 0);
  681. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  682. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  683. CalledMethod := 21;
  684. end;
  685. function TTestInterfaceClass.Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  686. begin
  687. SetLength(InputArgs, 10);
  688. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  689. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  690. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  691. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  692. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  693. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  694. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  695. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  696. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  697. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  698. SetLength(OutputArgs, 0);
  699. SetLength(InOutMapping, 0);
  700. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  701. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  702. CalledMethod := 22;
  703. end;
  704. function TTestInterfaceClass.Test23(aArg1: Variant): AnsiString;
  705. begin
  706. SetLength(OutputArgs, 0);
  707. SetLength(InOutMapping, 0);
  708. SetLength(InputArgs, 1);
  709. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  710. Result:=AnsiString(aArg1);
  711. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  712. CalledMethod:=23;
  713. end;
  714. function TTestInterfaceClass.TestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  715. var
  716. i: LongInt;
  717. begin
  718. SetLength(InputArgs, 1);
  719. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  720. SetLength(OutputArgs, 0);
  721. for i := 0 to High(aArg1.b) do
  722. Result.b[High(Result.b) - i] := aArg1.b[i];
  723. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  724. CalledMethod := 1 or RecSizeMarker;
  725. end;
  726. function TTestInterfaceClass.TestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  727. var
  728. i: LongInt;
  729. begin
  730. SetLength(InputArgs, 1);
  731. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  732. SetLength(OutputArgs, 0);
  733. for i := 0 to High(aArg1.b) do
  734. Result.b[High(Result.b) - i] := aArg1.b[i];
  735. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  736. CalledMethod := 2 or RecSizeMarker;
  737. end;
  738. function TTestInterfaceClass.TestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  739. var
  740. i: LongInt;
  741. begin
  742. SetLength(InputArgs, 1);
  743. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  744. SetLength(OutputArgs, 0);
  745. for i := 0 to High(aArg1.b) do
  746. Result.b[High(Result.b) - i] := aArg1.b[i];
  747. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  748. CalledMethod := 3 or RecSizeMarker;
  749. end;
  750. function TTestInterfaceClass.TestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  751. var
  752. i: LongInt;
  753. begin
  754. SetLength(InputArgs, 1);
  755. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  756. SetLength(OutputArgs, 0);
  757. for i := 0 to High(aArg1.b) do
  758. Result.b[High(Result.b) - i] := aArg1.b[i];
  759. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  760. CalledMethod := 4 or RecSizeMarker;
  761. end;
  762. function TTestInterfaceClass.TestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  763. var
  764. i: LongInt;
  765. begin
  766. SetLength(InputArgs, 1);
  767. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  768. SetLength(OutputArgs, 0);
  769. for i := 0 to High(aArg1.b) do
  770. Result.b[High(Result.b) - i] := aArg1.b[i];
  771. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  772. CalledMethod := 5 or RecSizeMarker;
  773. end;
  774. function TTestInterfaceClass.TestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  775. var
  776. i: LongInt;
  777. begin
  778. SetLength(InputArgs, 1);
  779. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  780. SetLength(OutputArgs, 0);
  781. for i := 0 to High(aArg1.b) do
  782. Result.b[High(Result.b) - i] := aArg1.b[i];
  783. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  784. CalledMethod := 6 or RecSizeMarker;
  785. end;
  786. function TTestInterfaceClass.TestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  787. var
  788. i: LongInt;
  789. begin
  790. SetLength(InputArgs, 1);
  791. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  792. SetLength(OutputArgs, 0);
  793. for i := 0 to High(aArg1.b) do
  794. Result.b[High(Result.b) - i] := aArg1.b[i];
  795. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  796. CalledMethod := 7 or RecSizeMarker;
  797. end;
  798. function TTestInterfaceClass.TestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  799. var
  800. i: LongInt;
  801. begin
  802. SetLength(InputArgs, 1);
  803. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  804. SetLength(OutputArgs, 0);
  805. for i := 0 to High(aArg1.b) do
  806. Result.b[High(Result.b) - i] := aArg1.b[i];
  807. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  808. CalledMethod := 8 or RecSizeMarker;
  809. end;
  810. function TTestInterfaceClass.TestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  811. var
  812. i: LongInt;
  813. begin
  814. SetLength(InputArgs, 1);
  815. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  816. SetLength(OutputArgs, 0);
  817. for i := 0 to High(aArg1.b) do
  818. Result.b[High(Result.b) - i] := aArg1.b[i];
  819. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  820. CalledMethod := 9 or RecSizeMarker;
  821. end;
  822. function TTestInterfaceClass.TestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  823. var
  824. i: LongInt;
  825. begin
  826. SetLength(InputArgs, 1);
  827. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  828. SetLength(OutputArgs, 0);
  829. for i := 0 to High(aArg1.b) do
  830. Result.b[High(Result.b) - i] := aArg1.b[i];
  831. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  832. CalledMethod := 10 or RecSizeMarker;
  833. end;
  834. procedure TTestInterfaceClass.TestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  835. begin
  836. if Length(ExpectedArgs) <> 4 then
  837. Exit;
  838. if Length(OutArgs) <> 2 then
  839. Exit;
  840. SetLength(InputArgs, 4);
  841. TValue.Make(@aArg1, ExpectedArgs[0].TypeInfo, InputArgs[0]);
  842. TValue.Make(@aArg2, ExpectedArgs[1].TypeInfo, InputArgs[1]);
  843. TValue.Make(@aArg3, ExpectedArgs[2].TypeInfo, InputArgs[2]);
  844. TValue.Make(@aArg4, ExpectedArgs[3].TypeInfo, InputArgs[3]);
  845. Move(PPointer(OutArgs[0].GetReferenceToRawData)^, aArg1, OutArgs[0].DataSize);
  846. Move(PPointer(OutArgs[1].GetReferenceToRawData)^, aArg2, OutArgs[1].DataSize);
  847. SetLength(OutputArgs, 2);
  848. TValue.Make(@aArg1, ExpectedArgs[0].TypeInfo, OutputArgs[0]);
  849. TValue.Make(@aArg2, ExpectedArgs[1].TypeInfo, OutputArgs[1]);
  850. SetLength(InOutMapping, 2);
  851. InOutMapping[0] := 0;
  852. InOutMapping[1] := 1;
  853. CalledMethod := -1;
  854. end;
  855. procedure TTestInterfaceClass.Reset;
  856. begin
  857. InputArgs := Nil;
  858. OutputArgs := Nil;
  859. ExpectedArgs := Nil;
  860. OutArgs := Nil;
  861. InOutMapping := Nil;
  862. ResultValue := TValue.Empty;
  863. CalledMethod := 0;
  864. end;
  865. function TTestInterfaceClass.DoAddRef: longint;
  866. begin
  867. Result:=_AddRef;
  868. end;
  869. function TTestInterfaceClass.DoRelease: longint;
  870. begin
  871. Result:=_Release
  872. end;
  873. destructor TTestInterfaceClass.Destroy;
  874. begin
  875. // Empty, for debugging purposes
  876. inherited Destroy;
  877. end;
  878. { TTestParent }
  879. function TTestParent.DoTest: String;
  880. begin
  881. Result:='Parent';
  882. end;
  883. procedure ProcTest1;
  884. begin
  885. TTestInterfaceClass.ProcVarInst.Test1;
  886. end;
  887. function ProcTest2: SizeInt;
  888. begin
  889. Result := TTestInterfaceClass.ProcVarInst.Test2;
  890. end;
  891. function ProcTest3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  892. begin
  893. Result := TTestInterfaceClass.ProcVarInst.Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  894. end;
  895. procedure ProcTest4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  896. begin
  897. TTestInterfaceClass.ProcVarInst.Test4(aArg1, aArg2, aArg3, aArg4);
  898. end;
  899. function ProcTest5: AnsiString;
  900. begin
  901. Result := TTestInterfaceClass.ProcVarInst.Test5;
  902. end;
  903. function ProcTest6: UnicodeString;
  904. begin
  905. Result := TTestInterfaceClass.ProcVarInst.Test6;
  906. end;
  907. function ProcTest7: WideString;
  908. begin
  909. Result := TTestInterfaceClass.ProcVarInst.Test7;
  910. end;
  911. function ProcTest8: ShortString;
  912. begin
  913. Result := TTestInterfaceClass.ProcVarInst.Test8;
  914. end;
  915. procedure ProcTest9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  916. begin
  917. TTestInterfaceClass.ProcVarInst.Test9(aArg1, aArg2, aArg3, aArg4);
  918. end;
  919. procedure ProcTest10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  920. begin
  921. TTestInterfaceClass.ProcVarInst.Test10(aArg1, aArg2, aArg3, aArg4);
  922. end;
  923. procedure ProcTest11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  924. begin
  925. TTestInterfaceClass.ProcVarInst.Test11(aArg1, aArg2, aArg3, aArg4);
  926. end;
  927. procedure ProcTest12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  928. begin
  929. TTestInterfaceClass.ProcVarInst.Test12(aArg1, aArg2, aArg3, aArg4);
  930. end;
  931. function ProcTest13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  932. begin
  933. Result := TTestInterfaceClass.ProcVarInst.Test13(aArg1, aArg2, aArg3, aArg4);
  934. end;
  935. function ProcTest14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  936. begin
  937. Result := TTestInterfaceClass.ProcVarInst.Test14(aArg1, aArg2, aArg3, aArg4);
  938. end;
  939. function ProcTest15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  940. begin
  941. Result := TTestInterfaceClass.ProcVarInst.Test15(aArg1, aArg2, aArg3, aArg4);
  942. end;
  943. function ProcTest16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  944. begin
  945. Result := TTestInterfaceClass.ProcVarInst.Test16(aArg1, aArg2, aArg3, aArg4);
  946. end;
  947. function ProcTest17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  948. begin
  949. Result := TTestInterfaceClass.ProcVarInst.Test17(aArg1, aArg2, aArg3, aArg4);
  950. end;
  951. function ProcTest18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  952. begin
  953. Result := TTestInterfaceClass.ProcVarInst.Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  954. end;
  955. function ProcTest19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  956. begin
  957. Result := TTestInterfaceClass.ProcVarInst.Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  958. end;
  959. function ProcTest20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  960. begin
  961. Result := TTestInterfaceClass.ProcVarInst.Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  962. end;
  963. function ProcTest21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  964. begin
  965. Result := TTestInterfaceClass.ProcVarInst.Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  966. end;
  967. function ProcTest22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  968. begin
  969. Result := TTestInterfaceClass.ProcVarInst.Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  970. end;
  971. function ProcTestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  972. begin
  973. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize1(aArg1);
  974. end;
  975. function ProcTestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  976. begin
  977. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize2(aArg1);
  978. end;
  979. function ProcTestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  980. begin
  981. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize3(aArg1);
  982. end;
  983. function ProcTestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  984. begin
  985. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize4(aArg1);
  986. end;
  987. function ProcTestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  988. begin
  989. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize5(aArg1);
  990. end;
  991. function ProcTestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  992. begin
  993. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize6(aArg1);
  994. end;
  995. function ProcTestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  996. begin
  997. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize7(aArg1);
  998. end;
  999. function ProcTestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  1000. begin
  1001. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize8(aArg1);
  1002. end;
  1003. function ProcTestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  1004. begin
  1005. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize9(aArg1);
  1006. end;
  1007. function ProcTestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  1008. begin
  1009. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize10(aArg1);
  1010. end;
  1011. procedure ProcTestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  1012. begin
  1013. TTestInterfaceClass.ProcVarInst.TestUntyped(aArg1, aArg2, aArg3, aArg4);
  1014. end;
  1015. constructor TTestConstructorCall.Create(aTest: ITestMethodCall);
  1016. begin
  1017. FTest:=aTest;
  1018. end;
  1019. function TTestConstructorCall.DoTest : string;
  1020. begin
  1021. Result:=FTest.Test;
  1022. end;
  1023. { TTest }
  1024. function TTest.Test : string;
  1025. begin
  1026. FTestCalled:=True;
  1027. Result:='In test';
  1028. end;
  1029. { TTestInvokeCast }
  1030. function TTestInvokeCast.Test(Arg: Single): Double;
  1031. begin
  1032. Result := Arg + 1;
  1033. end;
  1034. procedure TTestInvokeCast.Test2(var Arg: Single);
  1035. begin
  1036. Arg := Arg + 1;
  1037. end;
  1038. procedure TTestInvokeCast.Test3(Arg: TEnum1);
  1039. begin
  1040. end;
  1041. function TTestInvokeCast.Test4(Arg: UInt8): UInt8;
  1042. begin
  1043. Result := Arg + 1;
  1044. end;
  1045. end.