Nominate our 2022 Qt Champions!

QT dll question

  • If i make a QT dll i have the following 2 questions

    1.) Is there a depedency i will need to install or distribute with my dll in order for the user to load the dll so it can load a window?

    2.) How do i execute the code in the dll? with a simply loadlibrary call?( that is if im on windows )

  • Regarding the Qt library DLLs itself: You need to install all DLLs corresponding to the Qt modules you use (QtCore4.dll, QtGui4.dll an probably some more like QtNetwork4.dll or QtXml4.dll).

    Assuming that you build you own DLL to add functionality to something, you will have to distribute that DLL and all DLLs it depends on. So, if you use some Qt code in your DLL, you will have to ship the Qt DLLs too (unless you can be sure that they are installed by the host application already).

    Using the code depends: If you can link against the DLL, you can use it just like the Qt API. If your DLL is supposed to be used by others, then just ship it together with a header file (.h) so that the users can link against the DLL.

    If the DLL is purely optional (linking against a DLL creates a hard dependency), you could build a Qt based plugin. The users then can load the DLL using QPluginLoader. There are some examples in the docs (plug and paint example).

Log in to reply