[fpc-devel]win32 compiler funny

Florian Klaempfl Florian.Klaempfl at gmx.de
Thu Sep 21 13:49:43 CEST 2000


Pápai András wrote:
> 
> > OUT is used for COM support. It uses the same mechanism as VAR but no
> > value is passed when calling the procedure, only the output
> > is important.
> 
> How does this work? AFAIK using VAR parameters, the address is
> passed, not the value.
> 

Yes, but you removed the important sentence: 
This has only consequences for ref. counted types as ansistrings and interfaces.

This means: 

procedure p(out a : ansistring);

  begin
  end;

var
   ga : ansistring;

...
   p(ga);
...

Before calling p, the ref. count of ga is decreased (and if it is zero, the
data is disposed). and ga is set to zero/nil. 

The same happens for COM interfaces where this is necessary when you
request an interface.

For other data types (if they don't contain a ref. counted type) there
is _no_ difference to var calling conventions.




More information about the fpc-devel mailing list