Error while loading QtNetwork4.dll
-
wrote on 12 Dec 2011, 11:52 last edited by
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 -
Why do you use LoadLibrary()? On Windows, AFAIK, you can just place the .dll in the project folder and OS will load them automatically.
-
wrote on 12 Dec 2011, 12:58 last edited by
@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?
-
Yes, I think you are right. I am not too familiar with Windows, but the "custom" dll should manage to load QtNetwork itself, yes?
-
wrote on 13 Dec 2011, 00:03 last edited by
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.
-
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.
-
wrote on 13 Dec 2011, 13:06 last edited by
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.
6/7