Initialization order of Delphi unit

xiaoxiao2021-03-06  37

In the program, I used the Singleton mode, so I was in the initialization of this stuff, starting there is no problem, and then I always report in a module, debugging it is because the unit's reference order is incorrect. Check out the help of Delphi, simply: the order of unit initialization is the order of units being referenced (Uses): first starting from the unit referenced by the project file, then the depth is preferred. The Finalization order is just the opposite.

Finally, in order to avoid this problem, the instantiation of the single-piece object is placed in a static factory method because of the incorrect error of the unit.

转载请注明原文地址:https://www.9cbs.com/read-67758.html

New Post(0)