Utility for analysing symbols in a library file
Asked Answered
B

2

6

I'm having some problems with a large static library (.lib) file, and am suspecting code bloat from indiscriminate use of template classes. I want to analyse the symbols in the library to confirm which are making up the bulk of the file size.

When I link my executable against this library, the resulting output is much more sensible, size-wise (about 20Mb), so the linker is obviously stripping out lots of redundant symbols. I want to find out what its removing..

I know I can use dumpbin to generate the symbols and headers, but, with the library in question being pretty large (900Mb), this dump is pretty much unusable without a utility for parsing and reporting on it.

Obviously I could write this myself, but was wondering if anyone can recommend any freeware already available for this?

Billion answered 15/6, 2011 at 12:49 Comment(0)
B
2

I found one (SymbolSort) that works really well, gives me exactly what I need:

Billion answered 16/6, 2011 at 9:35 Comment(0)
S
2

Is this your own library? If so you can generate a link map that describes the layout of the code in the library, which would give you the info you need here in a more friendly form.

If you don't have source code access to do this, you could use Perl or other open-source scripting tools to crack the dumpbin output.

EDIT: you could also give LibDump a spin, it's downloadable from here. I have not used this myself.

Subkingdom answered 15/6, 2011 at 15:2 Comment(8)
Will that show me all the symbols that are stripped out by the linker?Billion
Not sure whayt you mean by that. It will show you where each function starts and how large it is - isn't that what you want?Subkingdom
As I understand it, there are many more symbols in the .lib file than will actually be used by the executable, as the linker strips out all the unused symbols (unless I'm mistaken?). I need to see all the symbols in the .lib file, not just those used by the executable - am just wondering if building a link map at link time will give me this, or only a map of what is used by the resulting .exeBillion
I am talking about generating a Map when you build the static library .LIB file, not the resulting .EXE. If you set /MAP on the executable link options then yes, you are right. If you (are able to) set it on the library link step, then you will see the entire contents of the static library.Subkingdom
As far as I'm aware, there is no linking involved when building a static library?Billion
Yes, you're right. Have you tried LIB /LIST, what does that show?Subkingdom
Thanks for your help.. I found one last night which sees to do the trick - its well worth a look. See my answer..Billion
I would edit the name of the utility you found into your answer and then accept it (you get a badge for that!). As you can see your q has several upvotes so the info would be useful to others. I've given you +1, nice research.Subkingdom
B
2

I found one (SymbolSort) that works really well, gives me exactly what I need:

Billion answered 16/6, 2011 at 9:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.