Kostas Michalopoulos schrieb:
Thanks, i understand that. My question is, can i somehow make FPC to add AddRef/Release calls also to TBlah so i can use refcounting with a class just like i would use it with an interface?
When you declare IBlah and implement it in TBlah, you can use: var MyBlah: IBlah; //instead of TBlah! ... MyBlah := TBlah.Create as IBlah; Now MyBlah will be destroyed when the last reference to it goes away.
Is there some technical limitation on why this is only done with interfaces and not all objects that descend from a refcounted interface?
Reference counting adds some runtime overhead. If you want all your objects reference counted, then use interface references instead of object references in your code, as outlined above.
DoDi -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus