[fpc-devel] ref count issue with out param

Martin Frb lazarus at mfriebe.de
Sat Jun 13 20:08:28 CEST 2015

On 13/06/2015 17:48, Florian Klämpfl wrote:
> Am 13.06.2015 um 16:42 schrieb Martin Frb:
>> On 13/06/2015 15:18, Florian Klämpfl wrote:
>>> Foo2(a1[i],a2[j])
>>> a1, a2 being dyn. arrays, but sharing data, i and j having the same value.
>> I dug out my old "turbo delphi".
>> In all both cases (my original example / you dyn array example) Delphi passes nil for the normal
>> parameter, and fpc passes a dangling pointer.
> This depends on the order in which parameters are loaded
I did all my tests with both orders
procedure Foo1(a: AnsiString; out b: AnsiString);
procedure Foo2(out a: AnsiString; b: AnsiString);

So in Delphi it does not depend on this order. The "none out" is always nil.

More information about the fpc-devel mailing list