Since we don't use "old" statics from the library with new code (statics that are already living in the app), we should somehow prevent double initialization, but keep new statics constructors. This is not important for primitive types, but for complex structures with non-trivial constructors it is essential. This is related only to global variables cause their constructors are called before dlopen returns and so have no chance to fix relocations for them.
Since we don't use "old" statics from the library with new code (statics that are already living in the app), we should somehow prevent double initialization, but keep new statics constructors. This is not important for primitive types, but for complex structures with non-trivial constructors it is essential. This is related only to global variables cause their constructors are called before
dlopen
returns and so have no chance to fix relocations for them.