Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Plugin DLL can't locate its DLL dependencies

Plugin DLL can't locate its DLL dependencies

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
7 Posts 3 Posters 1.8k 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.
  • Y Offline
    Y Offline
    yeehaw
    wrote on last edited by yeehaw
    #1

    I have a plugin application (.DLL) that links dynamically to multiple other QT DLLs. When the plugin is loaded in the third party software, it fails to find the dependencies which are located exactly in the same folder as the plugin DLL. The structure looks like this:

    myplugin.dll 
    platforms\
        qwindowsd.dll
    QtQml\
        qmlplugind.dll
    ...
    

    The executable of the software that loads the Plugin is installed under C:/Program Files/MySoftware/Application.exe

    Weirdly enough, when I copy the contents of my packaged plugin (dlls and its dependencies) directly into the software's executable directory, next to the executable, it works like a charm, and the plugin is able to find all its DLLs in that directory. So my guess is the DLL lookup isn’t appropriate?

    This relates to this: https://stackoverflow.com/questions/29528595/deploying-qt-dll-file-cannot-find-windows-plugin-although-platforms-qwindows-d but his solution was to simply deploy everything with the binaries of the application that loads the Plugin that uses QT, which seems like a bad solution.

    Any help on that matter would be appreciated. Thanks

    JKSHJ 1 Reply Last reply
    0
    • Y yeehaw

      I have a plugin application (.DLL) that links dynamically to multiple other QT DLLs. When the plugin is loaded in the third party software, it fails to find the dependencies which are located exactly in the same folder as the plugin DLL. The structure looks like this:

      myplugin.dll 
      platforms\
          qwindowsd.dll
      QtQml\
          qmlplugind.dll
      ...
      

      The executable of the software that loads the Plugin is installed under C:/Program Files/MySoftware/Application.exe

      Weirdly enough, when I copy the contents of my packaged plugin (dlls and its dependencies) directly into the software's executable directory, next to the executable, it works like a charm, and the plugin is able to find all its DLLs in that directory. So my guess is the DLL lookup isn’t appropriate?

      This relates to this: https://stackoverflow.com/questions/29528595/deploying-qt-dll-file-cannot-find-windows-plugin-although-platforms-qwindows-d but his solution was to simply deploy everything with the binaries of the application that loads the Plugin that uses QT, which seems like a bad solution.

      Any help on that matter would be appreciated. Thanks

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

      @yeehaw said in Plugin DLL can't locate its DLL dependencies:

      When the plugin is loaded in the third party software, it fails to find the dependencies which are located exactly in the same folder as the plugin DLL.

      ...

      Weirdly enough, when I copy the contents of my packaged plugin (dlls and its dependencies) directly into the software's executable directory, next to the executable, it works like a charm, and the plugin is able to find all its DLLs in that directory. So my guess is the DLL lookup isn’t appropriate?

      On Windows, the Exe's folder is a search path but the DLL's folder is not.

      To add a non-default search path for Qt plugins, call QCoreApplication::addLibraryPath() before instantiating your QCoreApplication (or one of its subclasses)

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

      1 Reply Last reply
      2
      • Y Offline
        Y Offline
        yeehaw
        wrote on last edited by
        #3

        Thank you so much for your answer @JKSH ! Now my dll is able to find the platform dll which was the initial problem, but my QML imports can't seem to locate the corresponding DLLs, which are located in the same root folder. I get errors of the sort of module "QtQuick" is not installed. Is there another specific path manipulation that should be done seperately? Thanks

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          @yeehaw said in Plugin DLL can't locate its DLL dependencies:

          Thank you so much for your answer @JKSH ! Now my dll is able to find the platform dll which was the initial problem

          Great!

          but my QML imports can't seem to locate the corresponding DLLs, which are located in the same root folder. I get errors of the sort of module "QtQuick" is not installed. Is there another specific path manipulation that should be done seperately? Thanks

          Root folder? You need to preserve the folder structure of the qml subfolders. You also need the qmldir files. See https://wiki.qt.io/Deploy_an_Application_on_Windows

          • <root>\platforms\qwindows.dll
          • <root>\QtQuick.2\qmldir
          • <root>\QtQuick.2\qtquick2plugin.dll

          If that doesn't work still, try calling QQmlEngine::addImportPath() (note: I haven't done this before so I'm not 100% sure)

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

          piervalliP 1 Reply Last reply
          2
          • JKSHJ JKSH

            @yeehaw said in Plugin DLL can't locate its DLL dependencies:

            Thank you so much for your answer @JKSH ! Now my dll is able to find the platform dll which was the initial problem

            Great!

            but my QML imports can't seem to locate the corresponding DLLs, which are located in the same root folder. I get errors of the sort of module "QtQuick" is not installed. Is there another specific path manipulation that should be done seperately? Thanks

            Root folder? You need to preserve the folder structure of the qml subfolders. You also need the qmldir files. See https://wiki.qt.io/Deploy_an_Application_on_Windows

            • <root>\platforms\qwindows.dll
            • <root>\QtQuick.2\qmldir
            • <root>\QtQuick.2\qtquick2plugin.dll

            If that doesn't work still, try calling QQmlEngine::addImportPath() (note: I haven't done this before so I'm not 100% sure)

            piervalliP Offline
            piervalliP Offline
            piervalli
            wrote on last edited by piervalli
            #5

            @JKSH
            Sorry, Have you tried with windeployqt for deploy?

            Exemple for window
            rem dir where the project is builded
            SET OUTDIR=C:\data\project-qt\build64Mingw
            SET DIRCOMPILER=C:\Qt\5.15.2\mingw81_64\bin
            SET COMPILERVERSION=release
            %DIRCOMPILER%\windeployqt --%COMPILERVERSION% --qmldir ..\qml %OUTDIR%

            JKSHJ 1 Reply Last reply
            0
            • piervalliP piervalli

              @JKSH
              Sorry, Have you tried with windeployqt for deploy?

              Exemple for window
              rem dir where the project is builded
              SET OUTDIR=C:\data\project-qt\build64Mingw
              SET DIRCOMPILER=C:\Qt\5.15.2\mingw81_64\bin
              SET COMPILERVERSION=release
              %DIRCOMPILER%\windeployqt --%COMPILERVERSION% --qmldir ..\qml %OUTDIR%

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

              @piervalli said in Plugin DLL can't locate its DLL dependencies:

              Have you tried with windeployqt for deploy?

              Yes, I have. Why?

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

              piervalliP 1 Reply Last reply
              0
              • JKSHJ JKSH

                @piervalli said in Plugin DLL can't locate its DLL dependencies:

                Have you tried with windeployqt for deploy?

                Yes, I have. Why?

                piervalliP Offline
                piervalliP Offline
                piervalli
                wrote on last edited by
                #7

                @JKSH , I thought the error " module "QtQuick" is not installed" war for missing library, sorry.

                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