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. How to disable run-time connection of optional libraries?
Forum Updated to NodeBB v4.3 + New Features

How to disable run-time connection of optional libraries?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.5k Views 2 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.
  • S Offline
    S Offline
    Stepan3.10.1996
    wrote on last edited by
    #1

    Hello!

    A program written using Qt 4.8.6 crashes when the system linker finds the QtXml4.dll library somewhere from another version of Qt and tries to load it. If we put QtXml from the same Qt assembly into the working directory of our program, then everything works fine (for a working directory on Win has a higher priority than paths from PATH). If you make sure that the linker does not find any QtXml4.dll at all (and do not throw anything into the working directory), then everything also works. Apparently QtXml does not link to our program anywhere. DependencyWalker says that no single binaries from the graph of static dependencies from this library also depend. There is a feeling that Qt implements some internal mechanism of dynamic loading of optional libraries. The only way I know how to implement such a system is to explicitly use something like LoadLibrary in the format "if the linker finds somewhere a shared library with the desired name, then load it, otherwise it will be hammered and worked on," but the search by code / documentation / Internet nothing on this topic did not give anything.

    I would be very grateful if someone would tell me what I'm doing wrong. Thank you in advance!

    JKSHJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What modules is your application using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Stepan3.10.1996
        wrote on last edited by
        #3

        I use QtCore, QtGui, QtNetwork, QtScript, QtSvg, Qwt.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you should check which of these library links to QtXml. The fact that your application doesn't use it doesn't mean it doesn't use something that might rely on in indirectly.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • S Stepan3.10.1996

            Hello!

            A program written using Qt 4.8.6 crashes when the system linker finds the QtXml4.dll library somewhere from another version of Qt and tries to load it. If we put QtXml from the same Qt assembly into the working directory of our program, then everything works fine (for a working directory on Win has a higher priority than paths from PATH). If you make sure that the linker does not find any QtXml4.dll at all (and do not throw anything into the working directory), then everything also works. Apparently QtXml does not link to our program anywhere. DependencyWalker says that no single binaries from the graph of static dependencies from this library also depend. There is a feeling that Qt implements some internal mechanism of dynamic loading of optional libraries. The only way I know how to implement such a system is to explicitly use something like LoadLibrary in the format "if the linker finds somewhere a shared library with the desired name, then load it, otherwise it will be hammered and worked on," but the search by code / documentation / Internet nothing on this topic did not give anything.

            I would be very grateful if someone would tell me what I'm doing wrong. Thank you in advance!

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            @Stepan3.10.1996 said in How to disable run-time connection of optional libraries?:

            (for a working directory on Win has a higher priority than paths from PATH).

            One good practice to follow is to avoid putting any Qt binaries in your system PATH. Is it feasible for you to remove all traces of Qt from your PATH?

            DependencyWalker says that no single binaries from the graph of static dependencies from this library also depend.

            By default, Dependency Walker only shows compile-time links. Select Profile -> Start Profiling... (F7) to find the run-time links.

            There is a feeling that Qt implements some internal mechanism of dynamic loading of optional libraries.

            Yes. The plugin system is one big example: http://doc.qt.io/qt-5/plugins.html (It's both used internally and externally)

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            1
            • S Offline
              S Offline
              Stepan3.10.1996
              wrote on last edited by
              #6

              I solved the problem.

              One of the plugins (QtSvg) connected the QtXml4 library. I added QtXml4.dll to the program folder, because only with it the plugin works correctly.
              In order to avoid such problems in the future, I put the qt.conf file (http://doc.qt.io/qt-4.8/qt-conf.html) next to the executable and configured it so that Qt does not connect libraries from the system paths (and from somewhere else, except from the folder with the program).

              Thanks for the tips.

              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