Microsoft equivalent of the nm command
Asked Answered
I

3

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.

Intermix answered 17/12, 2008 at 17:8 Comment(0)
A
38

Try dumpbin.exe.

MSDN dumpbin.exe reference.

Armlet answered 17/12, 2008 at 17:12 Comment(3)
both links are dead :-(Proprietress
yes, got it working. However, the MSDN documentation is next to worthless - a properly implemented --help argument could have superseeded it easilyProprietress
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.Mickelson
A
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.

Aggrieve answered 26/11, 2018 at 9:48 Comment(0)
G
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.

Gertrudis answered 15/6, 2023 at 6:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.