mr_ped Messages: 826 Registered: November 2005 Location: Czech Republic - Praha
Experienced Contributor
Straight solution is to have "is_inited" global variable for whole GUI thing and check it in every function call (and set it up only after GUI_APP_MAIN is executed), but this will cause lot of overhead...
Maybe in debug mode only?
Another way is to move all GUI functions into "gui" object instance ( UPPgui.font.FaceName("sans serif"); ), which can either be correctly initialized upon instantiation or the first the first instance may be stub with some ERROR() and then the object may be replaced after init with some real GUI object.
(again some overhead).
At compile time without overhead:
external tool after linking binary file to check ctor section to see what is called ahead of APP_MAIN, than scanning all sources for those ctor functions, emulating (interpretating them) and catching all GUI calls... .. oh well, this one would not really work.
Quote:
"It has taken me a lot of time to find out what caused this."
I'm sort of curious, why did it take so much time? Doesn't it crash in some nice way so you can see the stack and realize it was in FaceName, and ahead of APP_MAIN?