c - How to disassemble a .lib static library? -
i have written simple library in c:
library.h:
int sum(int a, int b); library.c:
#include "library.h" int sum(int a, int b) { return a+b; } i compiled cl.exe (visual studio 2012) using these commands:
cl /c /ehsc library.cpp lib library.obj which compiled static link .lib library file. have @ how compiler generated assembly code, learning/academic purposes. please note, don't want decompile it, want read generated assembly. have tried open .lib w32dasm lot of strange symbols , looks tool unable read file. i've have done similar task dynamic link library (generated same source) , worked; in able view assembly code using w32dasm. so, question is: possible view assembly code of static link library can dynamic link library? if so, correct tool use, since w32dasm not appear correct tool.
this technically little bit different because not going disassemble .lib file, purposes should enough:
you can use /fa switch, described in detail here. more precisely want use /fas should produce .asm file each source file containing both assembly , source code, helpful reference. example if add cl command:
cl /c /ehsc /fas library.cpp this should, in addition normal function, create file library.asm. file can possibly contain lot of stuff, searching through idea.
if using visual studio ide can set breakpoint, start debugging , right click source line , choose go disassembly. option shows in context menu during debugging , active during break, why setting breakpoint useful, can break manually.
Comments
Post a Comment