OK, What confused me is the description found in FPC manual saying:<br>
<p><var>TInterfacedObject</var> is a descendent of <a href="http://www.freepascal.org/docs-html/rtl/system/tobject.html">TObject</a> which implements the <a href="http://www.freepascal.org/docs-html/rtl/system/iunknown.html">IUnknown</a> interface. It can be used as a base class for all classes which need reference counting. </p>
in another word, reference counting is a feature of TInterfacedObject, or the AfterConstruction/BeforeDestruction methods?? it sounds like non-descedants of TInterfacedObject are not reference counted??<br><br><div class="gmail_quote">
2013/3/20 Hans-Peter Diettrich <span dir="ltr"><<a href="mailto:DrDiettrich1@aol.com" target="_blank">DrDiettrich1@aol.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Xiangrong Fang schrieb:<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I am reading this:<br>
<br>
<a href="http://wiki.freepascal.org/How_To_Use_Interfaces" target="_blank">http://wiki.freepascal.org/<u></u>How_To_Use_Interfaces</a><br>
<br>
And wondering what's the *purpose* of "reference counting"?<br>
</blockquote>
<br></div>
Delphi (and FPC) implements garbage collection by reference counting. It's used in all dynamic (managed) datatypes, like arrays, interfaces, AnsiStrings...<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
While I use interface before in delphi and java, I didn't notice that I need a UUID for interface. I had an impression that it has something to do with COM?<br>
</blockquote>
<br></div>
Right, an UUID/GUID for interfaces is Windows COM specific.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So, what is the purpose of this UUID and the method provided by TInterfacedObject?<br>
</blockquote>
<br></div>
The GUID allows to look up the interface definition when a type library (*.TLB) exists (on a Windows platform).<br>
<br>
DoDi<br>
<br>
<br>
--<br>
______________________________<u></u>_________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.<u></u>freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.<u></u>freepascal.org/mailman/<u></u>listinfo/lazarus</a><br>
</blockquote></div><br>