There are three approaches to dealing
with this problem:
Don’t do it.
Avoiding static initialization dependencies is the best
solution.
If you
must do it, put the critical static object definitions in a single file, so you
can portably control their initialization by putting them in the correct
order.
If
you’re convinced it’s unavoidable to scatter static objects across
translation units – as in the case of a library, where you can’t
control the programmer who uses it – there are two programmatic techniques