Reputation: 4071
Suppose I have two libraries, A.dll
and B.dll
. The library A
depends on B
. I want to load A
into my project.
My project is in C:/Project
. If I keep both A.dll
and B.dll
in C:/Project
, I can load A
with:
QLibrary lib("A");
lib.load();
This works fine. load()
will return false if B.dll
isn't in C:/Project
, though.
The problem is I want to keep both A.dll
and B.dll
in C:/Project/lib
. But when I move both libs to that location and try to load:
QLibrary lib("C:/Project/lib/A");
lib.load();
It fails. But this works if I keep A.dll
in C:/Project/lib
and B.dll
in C:/Project
.
How can I keep both libs in C:/Project/lib
and have A.dll
load successfully?
Edit: the error message I get is "Cannot load library C:/Project/lib/A . The specified module could not be found."
Upvotes: 2
Views: 4331
Reputation: 2008
You should add into your system environment the path to C:/Project/lib, or from the Projects tab into your QT Creator edit the Path variable(add the path to your libraries)
Upvotes: 0
Reputation: 648
Try using SetDllDirectory, see http://msdn.microsoft.com/en-us/library/ms686203%28VS.85%29.aspx
Upvotes: 2