[fpc-devel] interface vs optimizer

mariano podesta antiriad at gmail.com
Fri Jan 20 23:56:31 CET 2006


hi people,
there is a problem with functions returning interfaces:
if nobody stores the result, the object decrements one reference despite
turn off optimizations.

sample:

function getobj: IUnknown;
begin
  Result := TInterfacedObject.Create;
end;

procedure test;
begin
  getobj;
  // here result of getobj has died :(
end;

es there a solution or workaround?

thanks,
marianop
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20060120/db489b7c/attachment.html>


More information about the fpc-devel mailing list