[fpc-pascal] Check In Interface Type Helpers
Marcos Douglas B. Santos
md at delfire.net
Wed Aug 23 20:38:06 CEST 2017
On Wed, Aug 23, 2017 at 3:25 PM, Sven Barth via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:
> On 23.08.2017 19:57, Marcos Douglas B. Santos wrote:
>> Would we have any problem of memory leaks using Interface helper with
>> COM interfaces (refcount)?
>> I mean, the "type helper" has constructor/destructor to create/release
>> something?
>
> It doesn't need to. A type helper is essentially syntactic sugar for a
> class method with the extended parameter as first type.
So, is this work?
=== code begin ===
type
IFoo = interface
function Execute: IFoo;
end;
TFooHelper = type helper for IFoo
procedure Something;
end;
TFoo = class(TInterfacedObject, IFoo)
public
function Execute: IFoo;
end;
var
F: IFoo;
begin
F := TFoo.Create;
F.Execute.Something;
end;
=== code end ===
More information about the fpc-pascal
mailing list