Why do the MingW Qt DLLs have MSVCRT dependencies?

  • Why do the MingW Qt DLLs have direct dependencies on msvcrt.dll? I have spent the last 18 hours trying to trace down an extremely nightmarish bug and signs are pointing more and more to incompatibilities between STL headers and STL objects exported from msvcrt.dll (manifesting themselves as the impossible-to-debug "The runtime has requested the application terminate in an unusual way" message boxes titled "Microsoft Visual C++ Runtime").

  • MinGW uses msvcrt.dll as a C (not C++) runtime. MinGW C++ runtime is located in libstdc++6.dll

  • Executables built with MingW use the basic Microsoft C runtime, msvcrt.dll, found on every Windows machine. These are implementations of basic C library functions like malloc(), free(), fopen(), getenv() etc. There are also a few low-level C++ RTTI, exception and memory allocation related functions in that library.

    Most of the STL is templated code in headers but where functions are required they are found in the C++ runtime library. The Qt 4 bundled MingW's default behaviour is to statically link necessary parts of its C++ runtime (libstdc++) into your binary. I think the Qt5 bundled version uses dynamic linking (libstdc++-6.dll).

    You can clearly see what each DLL imports from msvcrt.dll using Dependency Walker.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.