474,007 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Release of a static .LIB in the VS 2005

Hi everybody !

Could anybody shed some light into the following paradox :

I am creating a static library under VS 2005 VC++ Win32 using MFC. If
compiled right after creating by a wizard, a release version of the LIB
shows the size of almost 2 MB - without any contents of mine ! The
debug version is less then a tenth of it at that...

Is it a problem of some wrong project settings or is it a bug? Or
maybe, this is OK so, then what sense can it have ?

Regards
Victor

Jan 14 '06 #1
7 2581
could you check that your release version is linked dynamiclly against MFC?
if it is linked against the static MFC libraries, that could account for the
difference.

configuration properties -> general ->use of MFC set to 'MFC in a shared
dll'

kind regards,
Bruno.
"Victor" <bi******@chefm ail.de> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
Hi everybody !

Could anybody shed some light into the following paradox :

I am creating a static library under VS 2005 VC++ Win32 using MFC. If
compiled right after creating by a wizard, a release version of the LIB
shows the size of almost 2 MB - without any contents of mine ! The
debug version is less then a tenth of it at that...

Is it a problem of some wrong project settings or is it a bug? Or
maybe, this is OK so, then what sense can it have ?

Regards
Victor

Jan 15 '06 #2
Thank you, Bruno

however, this option has been always selected in both debug and release
versions... exactly the way you say.
So, the reason must be elsewhere.

Victor

Jan 15 '06 #3
"Victor" <bi******@chefm ail.de> wrote
Could anybody shed some light into the following paradox :

I am creating a static library under VS 2005 VC++ Win32 using MFC. If
compiled right after creating by a wizard, a release version of the LIB
shows the size of almost 2 MB - without any contents of mine ! The
debug version is less then a tenth of it at that...

Is it a problem of some wrong project settings or is it a bug? Or
maybe, this is OK so, then what sense can it have ?

You probably build with /GL & /LTCG in release. The compiler will
save an intermediate representation instead of generated code in that
case. The switch is under General (not C/C++ !)->WPO.

You can run dumpbin on your object files. If it says anonymous object
you have an LTCG object.

Lib size is a poor indicator for actual code size. You really need to
take a look at final linked image file.

-hg
Jan 15 '06 #4
I have checked the switch General/WPO (if I understood it correctly, it
stays for Whole Programm Optimization). Indeed, there were differencies
between the both Debug and Release versions : Debug had 'No Whole
Programm Optimization', during Release had 'Use Link Time Code
Generation'.

Well, I changed the switch for Release to 'No WPO' either. This has
brought an immediate effect : the size of the .LIB file reduced to a
fifth ! (BTW - I meant always the real size of final linked file). It
is still fast 500 MB, nevertheless!

Is it not a bit exaggerated for an empty project? Are there any other
switches I should check?

Victor

Jan 16 '06 #5
"Victor" <bi******@chefm ail.de> wrote
I have checked the switch General/WPO (if I understood it correctly, it
stays for Whole Programm Optimization). Indeed, there were differencies
between the both Debug and Release versions : Debug had 'No Whole
Programm Optimization', during Release had 'Use Link Time Code
Generation'. Yes, I'm sorry WPO = Whole Program Optimization. In this case
the actual code generation is deferred to link time. It therefore enables
the compiler to do optimizations that require information from all
translation units (for instance inlining a function that is implemented
in another .cpp file)

WPO can reduce the code size (for the final EXE or DLL), but
modern desktop compilers are probably more geared for faster
code.
Well, I changed the switch for Release to 'No WPO' either. This has
brought an immediate effect : the size of the .LIB file reduced to a
fifth ! (BTW - I meant always the real size of final linked file). It Just to make sure. The .lib file is _not_ the final linked file. Only
EXE or DLL are. is still fast 500 MB, nevertheless!

I take it you mean KB. Otherwise it would really be a lot.

I'm not sure however, you fully understand what's going on.
The .lib is just a container for all object files (much like a tar
file or a zip file without the compression).

You said, you didn't add any source file yourself. So you'll
probably only have the MFC include files. These contain
inline functions and global data. Inline functions are only
emitted if referenced. So you'll probably only have data
symbols.

When you link your EXE or DLL the linker automatically
includes all object file you give on the command line.
Object files from .libs, however, will only be pulled in
if they contain a definition of a symbol that is referenced
by your code. That is, if you create a "Hello World" project
it doesn't matter if you link with a 100MB .lib or not - so long
as no symbols of the library are referenced.

Things get a bit more complicated with C++ code (which
uses COMDAT sections).

If you want a small image, make sure you build your lib
(or actually all of your code) with /Gy and link with /OPT:REF.

Again, only the size of your EXE or DLL is relevant.

-hg

Jan 16 '06 #6
Thank you Holger,

of course, I meant really 500 KB, not MB !..

Well, the size of my finally linked file (now I mean the target .EXE !
) is quite ordinary and makes me no trouble...

As I moved rather recently from the VC++ 6.0 to the VS 2005, only the
size of the .LIB made me wonder... When I created something like this
in 6.0, the LIB size was normally about 20 KB...

Surely, I can live with this situation as well. Pity about the disc
space only...

Victor

Jan 16 '06 #7
"Victor" <bi******@chefm ail.de> wrote
Well, the size of my finally linked file (now I mean the target .EXE !
) is quite ordinary and makes me no trouble...

As I moved rather recently from the VC++ 6.0 to the VS 2005, only the
size of the .LIB made me wonder... When I created something like this
in 6.0, the LIB size was normally about 20 KB...
You probably didn't build with debug info in VC 6 (it was off by
default in the wizard IIRC). You can try to turn off /Zi (BTW: You
can always look these up in MSDN Library in the index and there's
a description where you can find the corresponding setting in the
IDE).

That being said, I strongly believe that the improved debug
experience by far outweighes the disk size ;-)
Surely, I can live with this situation as well. Pity about the disc
space only...

:-)

-hg
Jan 16 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2926
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by using the following code in Page_Load event handler. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim intcount As Integer intcount = 0 For intcount = 0 To 4
1
2734
by: Jürgen Kahrs | last post by:
Hello, The beta alpha release (xgawk-3.1.5-beta.20060401) of the xmlgawk project is now available at SourceForge. http://sourceforge.net/projects/xmlgawk/ http://sourceforge.net/project/showfiles.php?group_id=133165 This release is based on Arnold Robbins' regular GNU Awk 3.1.5. Problem reports are supposed to go to xmlgawk-users@lists.sourceforge.net.
2
3366
by: HCF_15 | last post by:
Hi all, I have a small piece of code to use StackFrame to GetMethod, I found it is inconsistent in Debug version and Release version, is there anything I am doing wrong? Here is code, build in Debug and Release version, you will get different results. My env. is VS 2005 on XP with SP2. Thanks in advanced.
6
14442
by: laikon | last post by:
Hi, everyone, below is my program to test static pointer data member; class A { private: static A* p; protected: A() {} public: static A* init()
6
4814
by: bjornms | last post by:
The application i build in C#.net is crashing once a month. I can't reproduce the crash. Is there a way to track down where the program crashes, without putting logging everywhere in the code? Is there a way to get a stack trace of the crashing program (by the way, i'm new to C#.net, i have experience in (unmanaged) C++). Thanks in advance.
7
3072
by: =?Utf-8?B?R3JpZ3M=?= | last post by:
Hello, After getting some posts on forums.microsoft.com but no solution I was asked to post over here. Hopefully someone here can help with my problem. I have a Windows Forms application written in C# via VS 2003. It does 100% of what it should while in Debug mode (running in the debugger as well as running the .exe from File Explorer.) However, there is one thing it does not do when compiled in Release mode (running in the debugger...
5
2473
by: sujeet | last post by:
Dear friends, I'm facing a strange problem... My Application is in Debug mode, and the third party static library i'm using is in release mode. When i compile and try to link my application ... I get a linker error from the third party library as.
3
1863
by: Russ | last post by:
I have a Web Service that was originally created with .NET VC 2003, and subsequently converted to the 2005 version. It works fine when built as a debug version, and run on the workstation it was built on. Now I want to build a release version so I can deploy it to Windows 2003 server. This project is compiled with "/clr:oldSystax". I've run into several problems and I am not sure all of the things I am discovering are related. Any help...
2
2724
by: Dave Johansen | last post by:
I just converted a solution from Visual Studio 2003 to Visual Studio 2005 and the Debug mode seems to be running just fine, but the Release mode crashes on the following code: std::ifstream in("myfile.txt"); float value; in >value; //The crash happens here in the getloc() function The above code is actually from a library built in Debug mode that is linked into the Release build of the executable. Does anyone have any
0
10267
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11985
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11523
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
11030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7738
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
5295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4855
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3888
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.