<div>P.S. the Application object is used whcih some one earler suggested was not possible.</div>
<div> </div>
<div>The application does work!<br><br> </div>
<div><span class="gmail_quote">On 23/05/06, <b class="gmail_sendername">Paul A Norman</b> <<a href="mailto:paul.a.norman@gmail.com">paul.a.norman@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div>Just back in the basics where I am for a moment,</div>
<div> </div>
<div>This is some code I found following a link that Stefan suggested in another thread today. </div>
<div>What is the benefit of doing it all in <strong>initialization</strong> and <strong>finalization</strong> if it were contained in a form unit (which it was not incidentily)? </div>
<div> </div>
<div>initialization<br> begin<br> TComObjectFactory.Create(ComServer, TOurNSHandler, Class_OurNSHandler,<br> 'OurNSHandler', 'OurNSHandler', ciMultiInstance, tmApartment);</div>
<div>
<p> Table := TTable.Create(nil);<br> table.DatabaseName := ExtractFilePath(Application.ExeName);<br> table.TableName := DatabaseFile;<br> table.active := true;<br> end;</p>
<p>finalization<br> table.free;</p><br><br> </div>
<div></div>
<div><span class="e" id="q_10b5fc168fe36e76_1"><span class="gmail_quote">On 23/05/06, <b class="gmail_sendername">Karl @ Work</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:karlreynolds@xtra.co.nz" target="_blank">
karlreynolds@xtra.co.nz </a>> wrote:</span> </span></div>
<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"></blockquote></div>
<div><span class="e" id="q_10b5fc168fe36e76_3">> I'm curious as to why each of your consuming units needs to keep a<br>> reference to the singleton? <br>><br>> IMHO, surely the whole point about a singleton is that you don't keep
<br>> references per se to it.<br>><br>> When you need to access the singleton, you should just call your<br>> Singleton function declared in your MySingletonUnit unit? <br>><br>> Surely that would result in a whole lot less reference counting, and
<br>> worrying about who's holding on to it and when they drop their<br>> references, etc.<br><br>I would prefer not to keep references to the singleton in the consuming <br>units, it's just that I haven't found another way to ensure that it will
<br>free itself both (a) after everything else has finished using it and (b)<br>before the program finishes. The problem is that the singleton can't be <br>cleaned up in the finalization of its own unit because there are still
<br>references to it which are accessed after that.<br><br>Cheers,<br>Carl<br><br></span></div>
<div><span class="q">_______________________________________________<br>Delphi mailing list <br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Delphi@ns3.123.co.nz" target="_blank">Delphi@ns3.123.co.nz
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://ns3.123.co.nz/mailman/listinfo/delphi" target="_blank">http://ns3.123.co.nz/mailman/listinfo/delphi</a><br><br><br></span></div>
<div>
<blockquote></blockquote></div><br> </div></blockquote></div><br>