<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-04-12 12:12 GMT+02:00 Maciej Izak <span dir="ltr"><<a href="mailto:hnb.code@gmail.com" target="_blank">hnb.code@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">2016-04-12 12:01 GMT+02:00 Maciej Izak <span dir="ltr"><<a href="mailto:hnb.code@gmail.com" target="_blank">hnb.code@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">To protect our management operators we should declare in System.pp:<br></div><div><br></div><div>  FixedAttribute = class(TCustomAttribute); // or SystemInitializedAttribute<br></div><div><br></div><div>Now the <span style="font-size:12.8px">gSomething from example is declared as:</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">var</span></div><div><span style="font-size:12.8px">  [Fixed] gSomething: TSomeType; // fixed can be used only for global variables and for class var/{$J+} const (aka static var)</span></div></div></div></blockquote><div><br></div></span><div>Of course is still possible to obtain the error, but to achieve this you need to really crave this.</div></div></div></div></blockquote><div><br></div><div>To to enable the complicated dependencies is possible to allow priority parameter for <span style="font-size:12.8px">Fixed attribute</span>:</div><div><br></div><div><span style="font-size:12.8px">  FixedAttribute = class(TCustomAttribute)</span><br></div><div><span style="font-size:12.8px">    constructor Create(aPriority: Integer = 2000); // </span>can be default set to 2000</div><div>  end;</div><div><br></div><div>... some module A ...</div><div><br></div><div> <span style="font-size:12.8px">var</span></div><div><span style="font-size:12.8px">  [Fixed] gFoo: </span><span style="font-size:12.8px">TSomeType; // default priority is 2000</span></div><div><span style="font-size:12.8px">  [Fixed(10)] gSomething: TSomeType; // lower number means higher priority, for example, first 1000 can be reserved for internal FPC usage</span></div></div><div><br></div><div><br></div><div>... somewhere in other module B, gSomething2 has Initialize operator, where <span style="font-size:12.8px">gSomething </span>is used for something...</div><div><br></div><div><div class="gmail_quote"><div><span style="font-size:12.8px">var</span></div><div><span style="font-size:12.8px">  [Fixed(100)] gSomething2: TSomeType; // has lower priority and will be initialized after </span><span style="font-size:12.8px">gSomething and finalized before </span><span style="font-size:12.8px">gSomething</span></div><div><span style="font-size:12.8px"><br></span></div></div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>