How to read a .obj file?

前端 未结 3 1325
离开以前
离开以前 2021-01-13 16:59

In visual studio a object file (.obj) is generating after compiling a c++ file. How to read and understand it? Also how to see the code after compiler optimization in Visual

3条回答
  •  醉梦人生
    2021-01-13 17:30

    Dumpbin at the /all setting shows code sections & directories. Detailed explanations of things like code section characteristics is not common knowledge, but may be found in certain books. Here's a precis on COFF, here's a more detailed description, or there's even a WYSINWYX thesis.

    Adding to @cynic's answer, in Visual Studio (15 & 17) it's possible to run DumpBin via the menu. Go to Tools/External Tools and click Add. Put in the Title box something like DumpBin Your_Exe or Your_Obj name and find the path for DumpBin if it isn't in the environment settings. It can be similar to the following:

    c:\program files (x86)\microsoft visual studio\2017\community\VC\Tools\MSVC\SDK-Version\bin\Host $(Platform)\$(Platform)\dumpbin.exe

    and add it to the Command box. For arguments try something like:

    /ALL /OUT:C:\Users\New\Desktop\dumpofYour_ExeName.txt "Pathname to your obj/executable file"

    and yes, the quotes will work.

    If using the desktop, put that in the initial directory box as well. Select "prompt for arguments" if you wish to leave the Argument box blank.

提交回复
热议问题