25

When I point to my C++ dll from DependencyWalker, I see the error message "At least one module has an unresolved import due to a missing export function in an implicitly dependent module"

Can you please suggest what the error is?

InfoLearner
  • 14,952
  • 20
  • 76
  • 124

2 Answers2

13

Your dll (or a dll that it imports) has an import from another dll (bad.dll say). When DependencyWalker scans bad.dll it finds that it does not export the required function. This missing export will be labelled in red (or somesuch) in your dll's import list.

  • ViewUndecorate C++ Functions might be useful to you.
bobbogo
  • 14,989
  • 3
  • 48
  • 57
  • I have this problem when I try to run an EXE that depends on some external dlls. Is this an issue that will always prevent an executable from running or is this simply something that /could/ cause an error when, say, a call is made to these un-exported functions? – Carrotman42 Jun 06 '12 at 14:00
  • 2
    Nearly always, yes. All imports are resolved at load time.Note though that some imports can be marked "delay load" (these show up in DependencyWalker marked with an hour glass icon (or somesuch)). These imports are not resolved by the Windows' loader until the application actually calls them. I have used this to ship an app that loads the OpenGL/DirectX DLLs only after the user has chosen which API to use. – bobbogo Jul 08 '12 at 19:00
  • 3
    This answer was never marked formally as the answer, and doesn't provide enough detail to be useufl. Why would Undecorate C++ Functions be useful? You didn't say what it was supposed to do. – shawn1874 Nov 03 '16 at 20:33
0

To discuss further @bobbogo's answer, you need to have the exact same symbol in the child library as the one needed by the first library. For example I had a problem because opencv_highgui455.dll needed the function QTest::keyToAscii, found in Qt.

QtTest6.dll had the correct function in it, but not the exact same symbol, because this version of Qt was compiled with mingw and opencv was compiled with Visual Studio. Thus the dll could not share their symbols and understand each other.

You can see this either by doing:

strings "[opencv4.5.5]\x64\vc16\bin\opencv_highgui455.dll" | grep keyToAscii   
# returns ?keyToAscii@QTest@@YADW4Key@Qt@@@Z

strings "[qt6]/msvc2019_64/Qt6Test.dll" | grep keyToAscii
# returns ?keyToAscii@QTest@@YADW4Key@Qt@@@Z
strings "[qt6]/mingw_64/Qt6Test.dll" | grep keyToAscii
# returns _ZN5QTest10keyToAsciiEN2Qt3KeyE

or you can directly see that in Dependencies (note the red card or the green card, and the Demangler): enter image description here enter image description here

PJ127
  • 986
  • 13
  • 23