gcc makes this really easy with a straightforward compiler extension. All we have to do is write a regular `void f(void)` function and mark it with: __attribute__((constructor)) Literally that's it. Someone tell Microsoft how cool this is!