Donald Duck Donald Duck - 1 month ago 12
C++ Question

Can i simply put dll library to the Windows folder?

I am using Qt in my C++ application. I'm using dynamic linking so it comes with few dll files like:


  • Qt5Core.dll

  • Qt5Gui.dll

  • Qt5WinExtras.dll

  • Qt5Widgets.dll

  • Qt5Network.dll



Thats much files and I would like to simply have a one "exe" file in the main folder. I'm using Inno Setup installer and I would like to install these dll files directly to the
Windows/System32
folder because I tested it and it will be working just fine that way.

The question is - should I do that? I mean, wouldn't it be fragile and will it work on every Windows system without any problems?

Answer

This is not a really good idea for multiple reasons :

  • Other Qt applications might be built using a different version of Qt. These will not work anymore. If you right click Qt5Core.dll you can see the version of qt used to build this lib.

  • Your application can't control the dll anymore, other application could potentially delete/update these lib : your app would not work anymore

  • new version of your application might not be able to coexist with old ones if using different version. Mostly problematic for you (for testing purposes)

If you really want to deploy a single exe, I recommend to make a stand-alone executable : https://wiki.qt.io/Build_Standalone_Qt_Application_for_Windows

Legally, you should allow the user to be able to edit the Qt libs and use a personalised one, for this reasons, the best way is to create a deployement package that contains all dll alongside the exe

Comments