Error while loading QtNetwork4.dll



  • 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


  • Moderators

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



  • @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?


  • Moderators

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



  • 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.


  • Moderators

    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.



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.