I'm in a bit of an exceptional situation: I have an application that compiles, links and launches when compiling with MSVC. I'm now in progress of recompiling it clang-cl, which causes it to compile, link and crash.
Thanks to Dependency Walker, I've found that unexpected DLLs are being loaded. In my case to find a symbol for std::allocator<char>::allocator(allocator const &).
With this, I currently have the following information:
- The DLL requiring this symbol
- The DLL exposing the symbol
- The symbol that is giving issues
In order to log a bug, I should be able to reduce the code to an acceptable size. Uploading the whole proprietary code base ain't an option, uploading a 20 line .cpp file is.
To reduce, I need to find the .cpp/.obj-file which requires this symbol. From there, reducing it becomes the easy work.
With this, I'm searching for a way to detect if an .obj file searches for a symbol in a different DLL.
I've already found:
- dumpbin /SYMBOLS: Tells me where a symbol gets exported
- dumpbin /DEPENDENTS: Tells me the DLL a DLL depends on
dumpbin /DEPENDENTS states:
Does not dump the names of the imported functions.
How do I dump the names of the imported functions, based on an .obj file?
dumpbin /symbolsis indeed the correct tool for the job as it also lists undefined symbols.For example, when using
dumpbin /symbolsto print the symbols in the object file generated from a source file containingwe get
As you can see, it contains both the symbol for the defined function
barand the symbol for the functionfoothat is merely declared. The difference is that forbarit says that the symbol can be found inSECT3wheras forfooit printsUNDEF.So in order to find all symbols that are imported from somewhere else (e.g. a DLL) you just need to search for
UNDEFin the output ofdumpbin /symbols.