如何阅读 C++ CLI .obj 文件(单个文件编译的结果)
我在 Visual Studio 2010 的 C++ CLI 项目中有一个小的(<300 行)C++ 文件。 我制作了一些宏,它们根据调试/发布配置执行不同的操作。
我希望能够查看生成的 .obj 文件(当我在调试和发布中编译时)并能够比较两者。困难的部分是文件是二进制的,我不理解它们的格式。
我确信还有其他方法可以确保宏不具有破坏性 - 例如在运行时在两种模式下尝试它,但这会花费更多时间。另外,了解这些 .obj 中的内容会很酷。
谢谢,如果您有疑问,请告诉我。
I have a small (<300 lines) C++ file in a C++ CLI project in Visual Studio 2010.
I have crafted some macros which do different things depending on the Debug/Release configurations.
I would like to be able to look at the resulting .obj files (when I compile in Debug and Release) and be able to compare the two. The hard part is that files are binary and I do not understand their format.
I am sure there are other ways to ensure that the macro is not destructive - e.g. try it out at runtime in both modes, but that is a lot more time consuming. Plus, it would be cool to learn what those .obj have in them.
Thanks, let me know if you have questions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Dumpbin.exe 有一些选项可以查看 .obj 文件内容。构建最终的 DLL 并使用调试器查看生成的机器代码或使用 Ildasm.exe 或 Reflector 查看 IL 应该会更加高效。
Dumpbin.exe has some options to peek an the .obj file content. Building the final DLL and looking at either the generated machine code with the debugger or the IL with Ildasm.exe or Reflector ought to be a lot more productive.