Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Load dynamic library failed
Forum Updated to NodeBB v4.3 + New Features

Load dynamic library failed

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 5 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • aha_1980A Offline
    aha_1980A Offline
    aha_1980
    Lifetime Qt Champion
    wrote on last edited by aha_1980
    #4

    so use the same Qt version is the only solution? I cannot get the source code of the dll I need but the only compiled dll file.

    Then use the exact same version the DLL was built with for your program.

    Qt has to stay free or it will die.

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #5

      It should also be possible to use a newer Qt version for your app - Qt is backwards compatible for major versions so a plugin compiled e.g. against Qt6.5 will properly work with Qt6.8 but not the other way round.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cliii
        wrote on last edited by
        #6

        Then what should I do if I need to use two dynamic libraries developed by different Qt Version?

        C 1 Reply Last reply
        0
        • mrdebugM Offline
          mrdebugM Offline
          mrdebug
          wrote on last edited by
          #7

          Hi, try to put the dll in a subfolder and then use this object to load it
          QLibrary Library;
          Library.setFileName("dir01/mydll.dll");
          Please remember, if the dll requires its plugins, other dll or a particular msvc version you have to install all them

          Need programmers to hire?
          www.labcsp.com
          www.denisgottardello.it
          GMT+1
          Skype: mrdebug

          Christian EhrlicherC 1 Reply Last reply
          0
          • C cliii

            Then what should I do if I need to use two dynamic libraries developed by different Qt Version?

            C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #8

            @cliii Read the answers you already have and apply them to the specifics of your situation.

            You cannot mix Qt 5.x and Qt 6.x for example.
            You cannot use a plugin from Qt 5.2 in a program built with Qt 5.15.
            You cannot mix 32-bit and 64-bit libraries, even with identical Qt versions.
            You cannot mix libraries built with Microsoft tools and those built with MingW.

            1 Reply Last reply
            1
            • mrdebugM mrdebug

              Hi, try to put the dll in a subfolder and then use this object to load it
              QLibrary Library;
              Library.setFileName("dir01/mydll.dll");
              Please remember, if the dll requires its plugins, other dll or a particular msvc version you have to install all them

              Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #9

              @mrdebug You are just plain wrong - it's not possible to load e.g. two different QtCore dlls into one address space.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cliii
                wrote on last edited by
                #10

                The only problem is different Qt versions have the same dll file names(Qt5Core.dll for example). If they are different names(Qt_5_12_Core.dll for one and Qt_5_2_Core.dll for another then I can put them in the same fold). Maybe i can try to change -lQt5Core to -lQt5Core1 in the Makefile of my own program and then change Qt5Core.dll to Qt5Core1.dll.

                Christian EhrlicherC 1 Reply Last reply
                0
                • mrdebugM Offline
                  mrdebugM Offline
                  mrdebug
                  wrote on last edited by
                  #11

                  The dll you have to use what it is for?

                  Need programmers to hire?
                  www.labcsp.com
                  www.denisgottardello.it
                  GMT+1
                  Skype: mrdebug

                  1 Reply Last reply
                  0
                  • C cliii

                    The only problem is different Qt versions have the same dll file names(Qt5Core.dll for example). If they are different names(Qt_5_12_Core.dll for one and Qt_5_2_Core.dll for another then I can put them in the same fold). Maybe i can try to change -lQt5Core to -lQt5Core1 in the Makefile of my own program and then change Qt5Core.dll to Qt5Core1.dll.

                    Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    @cliii When it's a plugin - why do you need to link against it then?
                    Also, as I said you can not link agsinst two different version of the same library.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      cliii
                      wrote on last edited by
                      #13

                      It is not a Qt plugin, just a common dynamic library, use .lib and .dll file to link

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Online
                        Christian EhrlicherC Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

                        So what's the real problem then? Simply link the library to your app and you're fine as long as you use the same or newer Qt5 version.

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved