Important: Please read the Qt Code of Conduct -

Use local dll instead of system32's dll

  • Hello, is there way to force my application to use the local dlls instead of getting them from system32?? I imagine this can be done with a static deployment, but I have had some troubles compiling Qt statically

    Thank u very much guys

  • Windows searches for libraries in the following sequence:

    • The directory where the executable module for the current process is located.
    • The current directory.
    • The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
    • The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
    • The directories listed in the PATH environment variable.

    Just place the libraries either in the executable or current directory. There is no need to link Qt statically.

  • Man, thank you very much for your reply, but I have this problem the fu&%$ msvcrt.dll I need came from Windows 7 if I try to run my app in windws XP , it just doesnt because it is not the same version of the file in the system32 folder, so I put the windows 7 version of the DLL in the directory where the executable module for the current process is located and my app is not taking it from there, it just goes and take it from system32 and load it from there

  • The situation is a bit different for msvcrt.dll, because it is a so-called known DLL. Those are not searched for and they are always taken from their known location (the system directory in this case).

    But you should redistribute the run-time libraries (in form of a Visual C++ Redistributable Package for MSVC) with your application anyways.

    See "Deploying an Application on Windows":

  • Hi, Lukas, thank you again, this is totally crazy to me, man. I already installed Microsoft Visual C++ 2010 Redistributable Package (x86) and and launches the same error saying that _except_hanlder4_common is not in msvcrt.dll , nohting I have encountered in INternet about this error works :S nothing...
    do you think that building my .exe statically would avoid this problem??
    Either way, I'm really tired of trying to compile Qt statically and is a really pain in the ass, I don't get what's missing, I have followed enough tutorials about it and I can't get it working right compilation ends with errors
    I have downloaed the source from version 4.7.4 from qt webpage, put it in a different folder and just doesn't compile

  • Did you try to search for "_except_handler4_common" (you have a typo in your string!)? It brings back a big bunch result pages with the very same error you are facing.

    This "blog article": looks promising.

  • The next question is, why does your application depend on msvcrt.dll. The default linkage should link to a library from the redistributable package, not the system library. Did you tinker with the linker flags?

  • Thank you again , both
    Volker: I'm sorry, what do you mean with " you have a typo in your string!" And, man, this is frustrating I have days trying everything I find in Google, the one you sent me was the first thing a tried and nothing, believe me, I have tried everthing

    Lukas: Actually yeah, I tinkered with some flags of the qmake.conf file trying to make an static linking, wish never worked because building qt statically is such a pain in the ass. then I reinstalled everthing and compiled my project again, and the errors about missing functions in the msvcrt.dll are still appearing
    I made up with a "solution" (believe me, I hate it but it makes my program run on windows 7 and windows xp) Compiling on windows XP makes everything works on both platform. Yeah, hit me in the face if you want to, but I have days reading and trying to make work and just this worked. Something weird about this, after compiling on windows xp, some SSL Handshaked Failed error pops up when I send the get request, something that never came up compiling on windows 7, anyways, I solved this using qnetworkreply->ignoreSSLerrors() and well, my app seems to be working ok so far on both platforms.

    Whatever you can come up, any idea, it will be very welcome

  • Lukas: I almost forgot, the dependenc on msvcrt.dll ,I found out on Internet , does'nt come from my app but from the compiler mingw g++ , it uses it some stuff of microsoft c++ runtime libraries

  • Did you redistribute your application with appropriate MinGW runtime files (depends on your MinGW version, most probably mingwm10.dll, libgcc_s_dw2-1.dll or libstdc++-6.dll, libgcc_s_sjlj-1.dll)?

    I'm not quite sure what could cause this, cause honestly I've never seen this error before.

  • Yes, I put all of them in the same .exe directory
    Now, one question, have you made something , like in my case, compiled in windows 7 and then using it in windows xp?

  • Yes, I do compile on Windows 7 SP1 Build 7601 x64 using i686-w64-mingw32-gcc-4.7.0-release-win32_rubenvb. The binaries run as expected on Windows XP Professional SP3 Build 2600.

    Make sure you've installed Service Pack 2 for Qt 4 and Service Pack 3 for Qt 5 on Windows XP!

  • There's got be something out of the ordinary with my app, then, my app interacts with Google Calendar Api, besides, uses QAxcontainer to embeed Microsoft Word Ole component, So maybe on of those things make it acts weird, I don't know :S

  • Hi Guys, I exactly have the same problem leninbooter has. (I was almost giving up, since I thought I was the only one with the same problem...)

    First of all, some information about my build-system configuration:
    Windows 7 (32 bit) on a core2duo p8700 system
    QT 4.8.1
    mingw 4.4.0

    The target is a Windows XP Version 2002 with SP3 (32 bit) system

    In the program I wrote, I am using TCP sockets to communicate with some measurement devices. I first had some problems with getting procedure entry point errors concerning the microsoft socket API, but these errors could be removed by deploying the necessary Win7 DLLs in the application directory.
    After this, I encountered the same problem leninbooter has.
    I tried to solve the error on the same manner as mentioned above, but this does not have any effect.

    I don't know if I even run into other severe problems just in case we get this error solved...

  • In the meantime I tried to find a solution for the problem again, because this one really upsets me...
    I just want to keep you informed, just in case someone also tries to solve it.

    I tried several configurations and also tried to build my application on windows xp. I found out that a DLL ("WS2_32.DLL") which I use, caused the problems in my case. If I use the Windows XP Version of this DLL, everything works just fine (for Windows XP as well as Windows 7, no matter with which operating system I build my application) in my case.

    @Leninbooter: Perhaps you try it this way: Whatever "operating system dependant" DLL you use, try to take the respective DLL which belongs to the operating system you use (especially DLLs which are normally situated in "c:\windows\system32"). In my case, the "WS2_32.DLL" from Windows XP seems to be compatible with Windows 7, but I think that cannot be said in general for other DLLs. I would be very interested, if you can make any progress in this way.

  • Have you tried to copy all the DLLs in your executable folder and executing it? Maybe there is some missing DLLs that generates your problem.

    I posted this "inverse" method that worked for me "here":

Log in to reply