Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining what object files have caused .dll size increase [C++]

Tags:

c++

size

I'm working on a large c++ built library that has grown by a significant amount recently. Due to it's size, it is not obvious what has caused this size increase.

Do you have any suggestions of tools (msvc or gcc) that could help determine where the growth has come from.

edit Things i've tried: Dumpbin the final dll, the obj files, creating a map file and ripping through it.

edit again So objdump along with a python script seems to have done what I want.

like image 935
Chris Hamons Avatar asked Jun 01 '09 21:06

Chris Hamons


People also ask

How do you find out what is using a DLL?

Process Explorer has a facility that allows you to search through the currently running processes for a specific file. To perform this search go to Find -> Find Handle or DLL... and then enter the name of the file you are interested in. Save this answer. Show activity on this post.

What are DLL files in C?

In Windows, a dynamic-link library (DLL) is a kind of executable file that acts as a shared library of functions and resources. Dynamic linking is an operating system capability. It enables an executable to call functions or use resources stored in a separate file.

How are DLLs linked?

To use a DLL by explicit linking, applications must make a function call to explicitly load the DLL at run time. To explicitly link to a DLL, an application must: Call LoadLibraryEx or a similar function to load the DLL and obtain a module handle.


2 Answers

If gcc, objdump. If visual studio, dumpbin.

I'd suggest doing a diff of the output of the tool for the old (small) library, vs. the new (large) library.

like image 61
KeyserSoze Avatar answered Sep 22 '22 10:09

KeyserSoze


keysersoze's answer (compare the output of objdump or dumpbin) is correct. Another approach is to tell the linker to produce a map file, and compare the map files for the old and new versions of the DLL.

  • MSVC: link.exe /MAP
  • GCC and binutils: ld -M (or gcc -Wl,-M)
like image 28
bk1e Avatar answered Sep 18 '22 10:09

bk1e