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.1k 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.
  • C Offline
    C Offline
    cliii
    wrote on 11 Oct 2024, 05:44 last edited by
    #1

    My project (Windows Platform) need to load a dynamic library which was developed with Qt but not the same version as my own project. Because the dynamic library files of different Qt versions shares the same file name, I cannot put them in one fold (the fold of .exe file exactly). I put my Own Qt version library files there, so the dynamic library developed with other Qt version cannot be used. What can I do to solve this problem?

    C 1 Reply Last reply 11 Oct 2024, 05:59
    0
    • C cliii
      11 Oct 2024, 05:44

      My project (Windows Platform) need to load a dynamic library which was developed with Qt but not the same version as my own project. Because the dynamic library files of different Qt versions shares the same file name, I cannot put them in one fold (the fold of .exe file exactly). I put my Own Qt version library files there, so the dynamic library developed with other Qt version cannot be used. What can I do to solve this problem?

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 11 Oct 2024, 05:59 last edited by
      #2

      @cliii said in Load dynamic library failed:

      What can I do to solve this problem?

      Compile the plugins and your program with the same version. Everything else can't work.

      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
      1
      • C Offline
        C Offline
        cliii
        wrote on 11 Oct 2024, 06:10 last edited by
        #3

        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.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on 11 Oct 2024, 06:13 last edited by aha_1980 10 Nov 2024, 06:14
          #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
          • C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 11 Oct 2024, 06:19 last edited by Christian Ehrlicher 10 Nov 2024, 06:19
            #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 11 Oct 2024, 06:22 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 11 Oct 2024, 06:45
              0
              • M Offline
                M Offline
                mrdebug
                wrote on 11 Oct 2024, 06:41 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

                C 1 Reply Last reply 11 Oct 2024, 07:02
                0
                • C cliii
                  11 Oct 2024, 06:22

                  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 11 Oct 2024, 06:45 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
                  • M mrdebug
                    11 Oct 2024, 06:41

                    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

                    C Offline
                    C Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 11 Oct 2024, 07:02 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 11 Oct 2024, 07:07 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.

                      C 1 Reply Last reply 11 Oct 2024, 07:15
                      0
                      • M Offline
                        M Offline
                        mrdebug
                        wrote on 11 Oct 2024, 07:11 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
                          11 Oct 2024, 07:07

                          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.

                          C Offline
                          C Offline
                          Christian Ehrlicher
                          Lifetime Qt Champion
                          wrote on 11 Oct 2024, 07:15 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 11 Oct 2024, 08:41 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
                            • C Offline
                              C Offline
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on 11 Oct 2024, 09:15 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

                              1/14

                              11 Oct 2024, 05:44

                              • Login

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