[Qt-interest] a question about QLibrary

Constantin Makshin cmakshin at gmail.com
Fri Dec 4 00:08:35 CET 2009


It works here.

Try loading the library with native API. On Windows you can do something  
like this:

#include <stdio.h>
#include <windows.h>

int main (int, char**)
{
     printf("Trying to load A.dll ...");
     HMODULE dll = LoadLibraryA("A.dll");
     if (dll)
     {
         printf("   SUCCEEDED\n");
         FreeLibrary(dll);
     }
     else
         printf("   FAILED\n");
     return 0;
}

If native functions successfully fail to load your library, the problem  
isn't in Qt. Moreover, if it was a Qt bug, I'm sure it would have been  
already fixed.

On Fri, 04 Dec 2009 01:03:44 +0300, Yifei Li <yifli at mtu.edu> wrote:
> Hi,
>
> I tried to mannually load B.dll using QLibrary and that solved my  
> problem.
>
> So does that mean there's no way to load a dll that depends on another  
> dll at runtime without first loading its dependents?
>
> Can anyone give me an answer? Thanks
>
> Yifei
> ----- Original Message -----
> From: "Yifei Li" <yifli at mtu.edu>
> To: "qt-interest" <qt-interest at trolltech.com>
> Sent: Thursday, December 3, 2009 4:39:02 PM GMT -05:00 US/Canada Eastern
> Subject: [Qt-interest] a question about QLibrary
>
> Hi all,
>
> Suppose I have two dlls : A.dll and B.dll.   A.dll is dependent on B.dll.
>
> I failed to load A.dll into my app using QLibrary, the error message is :
> can not load library A.dll: (B.dll: can not open shared object file: No  
> such file or directory)
>
> I tried to put B.dll in the same directory ad A.dll, also tried putting  
> B.dll in the same directory as my application, but still got the same  
> error message.
>
> So can anyone tell me the correct way to load a dll that depends on  
> another dll at run-time?
>
> Thanks
>
> Yifei

-- 
Constantin Makshin



More information about the Qt-interest-old mailing list