If you want to call something after main, you may use atexit().
That's how gcc registers function declared with __attribute__((destructor)) and it's actually not what I want because my tests showed that such a function will be called before shared libs unloading, resulting in segfaults when Qt tries to do its cleanup...
Bookmarks