开发者

LoadLibrary fails and dependency walker does not help

开发者 https://www.devze.com 2023-03-10 09:58 出处:网络
I was trying to use QOCI plugin for QtSql, until I had some problems: Why QOCI plugin isn't working

I was trying to use QOCI plugin for QtSql, until I had some problems: Why QOCI plugin isn't working

However it turned out that it is a library loading issue (at least I think so), so I decided to change the subject of the question since it is a new question.

I have a dll file (called qsqloci4.dll) When I try to load it with LoadLibrary, it fails and GetLastError returns ERROR_MOD_NOT_FOUND. When I try to load it with LoadLibraryEx and 3rd parameter is DONT_RESOLVE_DLL_REFERENCES, it loads successfully (does not return NULL).

So, i thought it is a dependency issue. I opened the dll file with dependency walker, there were 2 files that couldn't be located: QtCore4.dll and QtSql4.dll. However, these files are in the working directory of application, and other dll files which are dependent on those dlls (such as qsqlpsql4.dll) are successfully loaded.

Other dlls (which are located by dependency walker) are:

  • oci.dll : is in same folder as QtCore4.dll and QtSql4.dll, means my app can access it
  • kernel32.dll : i believe the easiest dll to locate by my app
  • msvscr80.dll : other dll files which use this can be loaded successfully.

Here is my question: given dependency walker says : "you have all dlls except qt ones" and i am sure开发者_StackOverflow that I have qt dlls, what other reason can be for LoadLibrary to fail with ERROR_MOD_NOT_FOUND?


You need to run Dependency Walker in dynamic mode because the are some dependencies that will be resolved by explicit linking. I believe that you do this from the Profile menu.

0

精彩评论

暂无评论...
验证码 换一张
取 消