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. Error while loading QtNetwork4.dll
Forum Updated to NodeBB v4.3 + New Features

Error while loading QtNetwork4.dll

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 7.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.
  • A Offline
    A Offline
    aashish.lg
    wrote on 12 Dec 2011, 11:52 last edited by
    #1

    Hi,

    I have created one C++ dll project using QTCreator, this project depends on QtNetwork4.dll since it uses QTcpSocket inside it. when I put QtNetwork4.dll in the same project output folder and when trying to load my dll using LoadLibrary() call, it is giving error as "This application has failed to start because QtNetwork4.dll was not found. Reinstalling the application may fix this problem". When I try to open my dll in dependstool it is reflecting my exported functions from dll.

    Regards
    Ashish

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 12 Dec 2011, 11:56 last edited by
      #2

      Why do you use LoadLibrary()? On Windows, AFAIK, you can just place the .dll in the project folder and OS will load them automatically.

      (Z(:^

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on 12 Dec 2011, 12:58 last edited by
        #3

        @sierdzio
        As I understood it, the LoadLibrary call is for loading Ashish's own DLL which in turn depends on QtNetwork4.dll.

        @Ashish
        QtNetwork4.dll must be stored to the directory where your executable .exe is, not into the folder where your own DLL is.

        As a side note: Did you consider using [[Doc:QLibrary]] to load your DLL in a platform independent manner?

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 12 Dec 2011, 19:17 last edited by
          #4

          Yes, I think you are right. I am not too familiar with Windows, but the "custom" dll should manage to load QtNetwork itself, yes?

          (Z(:^

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on 13 Dec 2011, 00:03 last edited by
            #5

            The custom DLL usually doesn't load anything, it's the main executable/the kernel that is responsible for that. DLLs are searched in a search path, usually the system directories like C:\Windows... and the directory hosting the .exe.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sierdzio
              Moderators
              wrote on 13 Dec 2011, 07:22 last edited by
              #6

              I've never encountered that, myself. But, I've got everything in -path- PATH, so maybe it just worked. Anyway, thanks for info, I think I'll experiment with that topic a bit.

              (Z(:^

              1 Reply Last reply
              0
              • A Offline
                A Offline
                aashish.lg
                wrote on 13 Dec 2011, 13:06 last edited by
                #7

                Yes you are right, because of PATH environmental variable would have been set in your system , so that it has taken the reference from there, for me it was not set. I tried to put the QtNetwork4.dll in C:\Windows\System32 folder and then it Workz!!!

                Thanks a lot for suggestions.

                1 Reply Last reply
                0

                1/7

                12 Dec 2011, 11:52

                • Login

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