3 ms·
There's a simple solution you're missing here: __attribute__((constructor))
by nialv7 9y ago
There's a simple solution you're missing here:
__attribute__((constructor))
- kbob 9y agoThis is what I came to say. Here is a working example that builds an array of function pointers at program initialization time. https://github.com/kbob/schetoo/blob/master/prim.h#L215 https://github.com/kbob/schetoo/blob/master/prim.h#L215 This also works across multiple source files, unlike __COUNTER__.