Initialization/Finalization |
Top Previous Next |
What is translated > Statements > Initialization/Finalization
There isn't any direct counterpart for the sections "initialization" and "finalization" of a unit in C++. These sections are therefore translated as two functions which contain the respective instructions. In addition, a global variable of a class is defined. In the constructor of this class the initialization routine is called and in destructor the routine for the finalization is called. When the program is started, the global variables are created at first and therefore also the units are initialized.
initialization
pTest := CTest.Create;
finalization
pTest.Free();
->
void Tests_initialization() { pTest = new CTest; }
void Tests_finalization() { delete pTest; }
class test_unit { public: test_unit() { //AssertSystemInitialization(); test_initialization(); } ~ test_unit(){test_finalization(); } }; test_unit _test_unit;
There is a commented call to a functions "AssertSystemInitialization": This function may be used to force a special order in which different units are initialized. This function has to be written by the customer. E.g.
void AssertSystemInitialization() { test§_initialization(); test2_initialization(); }
|
This page belongs to the DelphiXE2Cpp11 Documentation |
DelphiXE2Cpp11 home Content |