I recently did a test build on a C template I keep around and it went from 4.5k to 30k (WTF mutter etc ....) and the problem traced down to using the wrong version of MSVCRT in the LIB directory. Added the version fom VC98 and it came back down in size again. Added a manifest and a version control block in the RC file which brought it up to 5.5k and to see if I could still remember how to write a function I added a MessageBoxIndirect() function. Window self centers, it has a basic menu and the version control block works correctly on XP.
For any interested the VC98 version of MSVCRT is attached in the zip file. Legally it is a redistributable so you should have no problems using it in an app.
which version yielded the 30 Kb file ? :eek
:bg
Any version that did not use the old VC98 MSVCRT. The problem is the standard C runtime library. If you don't have the right version of MSVCRT it pulls the maths functions used with divide "/" out of the main runtime and you get all of the startup code as well.
Class the VC98 MSVCRT as a DOWNdate as against an UPdate. :P
Hi Hutch,
I had to remove the manifest file as the menu items does not display the message box in the original executable. Also, I removed the msvcrt.lib dependency and the executable's size is reduced now to 5632 bytes.
About the mathematical operation, I extracted the object module containing the __ftoll function from Pelles C static library crt.lib. Running Polib with the /explode option extracts all the library members.
pocc.exe /Ze /Zx /Zl /Ot Project2.c
polink /SUBSYSTEM:WINDOWS /entry:main Project2.obj Rsrc.res kernel32.lib user32.lib _ftoll.obj
Project built with Pelles C 6.50 RC3
OS : XP Service Pack 3
Thanks Erol, thats an interesting effect, I still develop on XP SP3 and the message boxes all work correctly here. I had it building at 4.5k without the manifest and version control block but added them both to try and make it easier to recognise on Vista and Win7.
Quote from: Vortex on January 22, 2011, 11:13:13 AM
I had to remove the manifest file as the menu items does not display the message box in the original executable.
There is problem with some XP systems and programs which have manifest, but actually is not importing comctl32.dll
Anything app which uses manifest, then this app should be statically (implicitly) linked to the comctl32.dll.
This is done if called anything function from comctl32.dll. If no any functionality comctl32.dll is required, then needed to call InitCommonControls at least.
Hi Antariy,
Thanks for the info. I added a call to InitCommonControls and this solved the issue.
Alex,
Is that documented somewhere?
Quote from: GregL on January 26, 2011, 04:04:22 AM
Alex,
Is that documented somewhere?
Not sure about documentation. Probably it should be documented somewhere at MS.COM
Juadst added Alex's suggestion, included the common control library and made a call to InitCommonControls() and it builds fine here on my US English version of XP SP3.
Hi Hutch,
The new version works fine.
Thanks Erol.