You may even automatically create it in initialization section and automatically free it in finalization section. However, that means it will be only one instance (which is actually wise).
Great idea! Thanks!
I used the
initialization section to instantiate an object of the class. This solved the issues with access violation I had previously.
Based on this idea, I've created two units: one called uAppData.pas and one called uProgSettings.pas. The former is for "clearing the path" to get a configuration file, and the latter is application specific mainly for handling the ini-file for user settings.
However, now I have "timing" problem.
When I run the program first time it fails with:
Unable to open file <pathremoved>\grp_gen.ini
line 96 of uprogsettings.pas
line 7 of project1.lprWhen I run the program the second time, it (seems) to work as intended.
It seems uAppData initialization section isn't finalized before uProgSettings initialization section starts? (Or it may be a completely different issue).
How can I control this so that AppData has created the .ini file before uProgSetting initialization section is run?