DispInvoke arguments are not passed by reference when they should
Original Reporter info from Mantis: Gorelkin
-
Reporter name: Sergei Gorelkin
Original Reporter info from Mantis: Gorelkin
- Reporter name: Sergei Gorelkin
Description:
Delphi documentation on Automation objects states: "A parameter is passed by reference if the parameter expression consists only of a variable reference, and if the variable reference is of type Byte, Smallint, Integer, Single, Double, Currency, TDateTime, AnsiString, WordBool, or Variant. If the expression is not of one of these types, or if it is not just a variable, the parameter is passed by value".
This documentation appears to be incomplete/outdated; testing shows that Delphi 7 actually also passes by reference variables of type Int64 and WideString.
Behavior of types like ShortInt,Word,LongWord,QWord is questionable. They are known to COM, but aren't treated appropriately by Delphi.
FPC only passes by reference variables of type Variant. Moreover, it even doesn't compile some expressions.
Attached is a testcase showing the issue. It would be great if someone having recent Delphi version could run it and post the output.