title: How to reduce the size of a C++ static library
body: <p>I'm developing a cross-platform static C++ library and am wondering if there are any build flags for reducing the size of the final MyLib.lib and libMyLib.a files on each platform (iOS, Android, Windows)?</p>
  
  <p>I understand that every single dependency gets pulled into the build process and this is where my file size is coming from.</p>
  
  <p><a href="https://stackoverflow.com/questions/3332063/why-is-my-static-library-so-huge">Why is my static library so huge?</a></p>
  
  <p>But shouldn't there be some way to have the Linker/Librarian remove code from MyLib based on dependency calls actually made rather than theoretically possible?</p>
  
  <p>The Linker does this when building the final .EXEcutable, but it seems the same rules could apply at the library linking level.</p>
  
  <p>Overall this is a big problem for me because my cross-platform library is around 500MB for Windows and around 200MB on iOS.  Oddly, Android is a reasonable 3.5MB.</p>