Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - VS10 creates bloated static libs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

VS10 creates bloated static libs

 Post Reply Post Reply
Author
Message
rconn View Drop Down
Groupie
Groupie


Joined: 16 May 2007
Location: United States
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote rconn Quote  Post ReplyReply Direct Link To This Post Topic: VS10 creates bloated static libs
    Posted: 09 May 2010 at 4:54pm
Using 13.3.1 and VS2010.
 
I converted from 13.2.1 to 13.3.1 and switched to VS2010 at the same time.  After rebuilding everything I found that my release .exe's had increased 50% in size. 
 
I'm statically linking 13.3.1.  Looking at the libs I see that the Codejock *SU.LIB file has increased 40-50% in size using VS2010 versus the same lib using VS2008 (and is nearly the size of the debug lib).  The debug lib (*SUD.LIB) is roughly the same size as in VS2008.
 
I presume something is misconfigured in the VS2010 release properties.
Back to Top
eddiepaz View Drop Down
Groupie
Groupie
Avatar

Joined: 28 October 2004
Location: United States
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote eddiepaz Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2010 at 9:05am

I assume this has to do with VS 2010 creating bloated executables when statically compiling. A simple dialog application is now 1.6MB, and MS says it's because of the new features. <g>

Back to Top
rconn View Drop Down
Groupie
Groupie


Joined: 16 May 2007
Location: United States
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote rconn Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2010 at 9:34am
That might be part of it, though the Codejock-supplied projects were also including debug info in the VS2010 release builds.  When I took that option out, the Codejock libs dropped 30mb+ in size.  That reduced my release build size significantly, though it was still bigger than VS2008 (presumably because of VS2010 & static linking).
 
Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2010 at 12:26pm
I always include debug info in .LIBs, so that it gets propagated to the final .PDB and .MAP generated with the .EXE, making dumps readable. (I don't distribute the PDB or MAP.)

For a smaller EXE, you may want to turn on function-level linking (/Gy in the compiler),  so that unreferenced code doesn't get in the EXE. I don't know of anything this breaks, unless you're doing some weird stuff with pointers to functions or methods. I do this for all projects.

That note from Microsoft seems rather odd; I wonder if the MFC libraries are being compiled /Gy, or if they're just doing something else wrong.

Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)

Back to Top
rconn View Drop Down
Groupie
Groupie


Joined: 16 May 2007
Location: United States
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote rconn Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2010 at 7:19pm
I always use /Gy.  It doesn't help in this case.
Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2010 at 9:19pm
I wonder if the MFC lib is compiled with /Gy (or if there's some reason it can't be).

Product: Xtreme Toolkit Pro version 13.2 (Unicode, static build)

Platform: Windows 200x/XP/Vista/Win7 (32/64 bit)

Language: Visual C++ 9.0 (Studio 2008)

Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2010 at 9:50am
Are you using VS2008 or VS2008 SP1? My guess is that you get the same bloat in VS2008 SP1.
PokerMemento - http://www.pokermemento.com/
Back to Top
rconn View Drop Down
Groupie
Groupie


Joined: 16 May 2007
Location: United States
Status: Offline
Points: 79
Post Options Post Options   Thanks (0) Thanks(0)   Quote rconn Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2010 at 6:43pm
Nope, no problem with VS2008 SP1.
 
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 12 May 2010 at 4:02am
If you're linking statically with MFC, then you will get bloat in VS 2008 SP1 and VS 2010. This is due to the ribbon graphics included in the new versions of MFC.
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 12 May 2010 at 4:30am
Also, make sure you have NO references to afxcontrolbars.h or CWinAppEx.
PokerMemento - http://www.pokermemento.com/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.031 seconds.