windowsqtvisual-studio-2010dlldependency-walker

Dependency Walker parent import function list shows functions from a different lib


I am trying to include a external library (.lib pointing to a .dll) in my project. I am building on windows using QT (it appears to be using msvc2010 as the compiler) and have: LIBS += <path>/<libraryName>.lib in my .pro file. I have the corresponding .dll file in the directory where the executable is output so it can be found. When the program is run I get the following from QT:

Starting (program name)...
The program has unexpectedly finished.
(program name) exited with code -1073741515
Searching around it seems this type of error can come from .dll files being different in some way than you expect, which seems to be at least partially the problem here. When I open my program with dependency walker I can see that my .dll file found and the functions in it look to be correct as far as I can tell. However in the parent import function pane the functions do not agree or look correct (I think why I am getting my error). These function definitions exactly match the functions from another external library that I am using.

To me this indicates that somehow the .lib file is incorrect, however I have used this pair of .lib/.dll files before in a different program (not built in QT) and they worked fine. Also I have tried removing the reference to the .lib file from my .pro file and the correct functions calls complain (the ones from this library defined in the .dll file that is found). The .lib file looks exactly how I would expect it too using Dumpbin.exe /EXPORTS to view its content.

Any thoughts on what dependency walker is trying to tell me or what I should be trying now would be awesome.

edit 2/8: I have constructed a minimal example. It stops with the same error however in dependency walker instead of showing the functions from another library it shows no expected functions.


Solution

  • Looking at the explanation given for your minimal example it would seem what is happening here is that there are no MinGW function calls for the library (they are all MSVC calls). The functions found in the libraries are listed correctly because they are, just not being linked form the other compiler. As for why different libraries functions are showing up, I would guess its a bug in dependency walker.