39

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.

pnuts
  • 56,678
  • 9
  • 81
  • 133
David Norman
  • 18,830
  • 11
  • 63
  • 54

2 Answers2

38

Try dumpbin.exe.

MSDN dumpbin.exe reference.

Kunal Puri
  • 3,351
  • 1
  • 9
  • 22
Tim
  • 19,847
  • 23
  • 114
  • 212
  • 1
    both links are dead :-( – dothebart Jul 03 '18 at 13:47
  • yes, got it working. However, the MSDN documentation is next to worthless - a properly implemented `--help` argument could have superseeded it easily – dothebart Jul 05 '18 at 11:27
  • 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. – Bob Jarvis - Слава Україні Nov 26 '18 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.

Community
  • 1
  • 1
rashok
  • 11,758
  • 13
  • 85
  • 95