you can have pre-main functions in in C as well (as a GCC extension). If you define functions with `__attribute__(constructor)` and they will be called before main(). You can even set the priority on them, and set post-main destructor callbacks. This works even for shared libraries loaded in run-time.
I've used this as a trick to automatically run unit tests, though, not for any real work.
I've used this as a trick to automatically run unit tests, though, not for any real work.