On 23.08.2017 20:38, Marcos Douglas B. Santos wrote: > On Wed, Aug 23, 2017 at 3:25 PM, Sven Barth via fpc-pascal > <fpc-pascal@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 ===
Yes, this should work. Regards, Sven _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal