44

I've long used cygwin's nm command for all my .lib symbol debugging needs, but recently I thought about referring to it in a SO answer and realized that most Windows developers don't have cygwin installed.

So what is the Microsoft equivalent to nm, i.e., what command will list the symbols exported by a .lib file, the undefined symbols in the .lib, and so forth?

For the curious, a sample nm man page is here.

3 Answers 3

38

Try dumpbin.exe.

MSDN dumpbin.exe reference.

3
  • 1
    both links are dead :-(
    – dothebart
    Commented Jul 3, 2018 at 13:47
  • 1
    yes, got it working. However, the MSDN documentation is next to worthless - a properly implemented --help argument could have superseeded it easily
    – dothebart
    Commented Jul 5, 2018 at 11:27
  • 1
    Microsoft has three levels of support - primary support, advanced support, and technical support. These can be summed up with three phrases: 1) No one has ever reported an issue like that before; 2) Why would you ever want to do that?; and 3) I'm-pissed-I've-got-to-talk-to-actual-users-so-I'm-going-to-talk-real-fast-and-spout-code-like-a-fountain-and-you'd-better-get-it-all-down-the-first-time-because-I-will-NOT-repeat-myself. Commented Nov 26, 2018 at 12:16
7
  1. Run vcvarsall.bat which might present in your installed path of Microsoft Visual Studio. This sets environmental variable required for dumpbin.exe.

    D:>"D:\Program Files (x86)\Microsoft Visual Studio 10.0\vcvarsall.bat" x86

  2. Then use dumpbin.exe. For example dumpbin.exe /ALL <bin_file> gives all symbols.

0

The nm command provides -C option, which shows demangled names. There is c++filt in Linux/MacOSX, provide nearly the same as -C for nm.

On Windows, there is dumpbin.exe, which is like nm on Linux. There is also undname on Windows, which is like c++filt on Linux: (https://learn.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170)

C:\>undname ?func1@a@@AAEXH@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "?func1@a@@AAEXH@Z"
is :- "private: void __thiscall a::func1(int)"

You may also need vswhere to locate where dumpbin.exe and undname.exe located.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.