I wrote a portable abstraction for this that works across Linux, MacOS, and Windows: https://github.com/protocolbuffers/protobuf/blob/4917ec250d3...
I call them "linker arrays". They are great when you need to globally register a set of things and the order between them isn't significant.