2
votes

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 that I have qt dlls, what other reason can be for LoadLibrary to fail with ERROR_MOD_NOT_FOUND?

1

1 Answers

5
votes

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.