Assuming we have 3 projects. The first is a dynamically linked library that has a Q_COREAPP_STARTUP_FUNCTION that registers a type. The second one is a QML-Plugin that depends on the previous library and itself registers a type. The third is a QtQuick app that loads the plugin, but does not directly depend on the library.
What happens is that when trying to run the application, it fails to load the qml plugin with the error message (text freely translated from german)
Further debugging shows, that the application crashes inside the previously registered Q_COREAPP_STARTUP_FUNCTION inside the qmlRegisterType method! (Stacktrace attached) The curser shows that it crashes when trying to access the static meta object from the QML_GETTYPENAMES macro.
Whats strange about this issue is that this only happens when the main application does not directly depend to the library, i.e. it is loaded only on demand when loading the plugin. Directly linking the app to the lib does not trigger that exception, as the initialization code is loaded before entering the main and not from within the plugin loading. This only happens on windows. Testing on linux shows that loading works completley fine, even indirectly.
A sample project was attached to this issue. You can uncomment Line 5 in app/app.pro and rebuild the project to switch between the indirect loading (only plugin depends on dll) or the direct loading (app and plugin depend on dll).