if I use Win32GUI, my EXE files are VERY big (~ 800KB for Hello World, VC 7.1 release project).
Is this normal or could I set some compiler/linker options to reduce this code bloat?
Win32GUI version is 1.5.1
Well, I woudn't say "very big" ;)
It did add an about 350K as compared to the previous versions.
The problem is that compilers are *very poor* at realizing what should be optimized or not.
So, I had to make sure certain things (for auto-mapping to work correctly, event handling, but mostly, some code for the standard controls/tooltips) are *not* optimized away. Compilers will look at a lot of win32gui code and consider it "never used", even though it is - I had to trick them ;)
Hopefully, I'll once get time to explain this more thoroughly - but it's really advanced.
The good thing is that this 700Kb is pretty much the overhead of win32gui. That is, as your program gets bigger, the overhead will grow very slowly. You can try it - and you'll see.
(that is, you'll pay for what you use - but the core, well, it just needs to be there ;))
I have tested with a pretty big application I developed recently using win32gui, and the difference between v1.4.3 and v1.5.1 is 80K (and the size of the app. is 1600K).
(and take a look at the new things in v1.5 ;))
Ok, I see I have to live with this overhead...
The low overhead in size was the One Thing which I liked in WTL. But Win32GUI is otherwise so much better...
I have another question:
> code for the standard controls/tooltips
> are *not* optimized away
Why not, if I don't use them in my app?
The problem is not when you don't use them in your app. The problem is when you do use them, and they're not included.
(trust me, I've tested it quite a lot)
An example is for instance, the hyper_link. You can create a hyperlink (see examples/controls/hyperlink*) at dialog design time. Thus, there will be no reference in code - as to the usage of hyper links. Thus, the compiler would optimize it away...
And that is a simple example - there are many more ;)
Ok. Thanks, John.
in the lib directory of win32gui you've got only the staticaly linked library. So all the examples, and I suppose your hello world application links with that statically linked library.
If you want other version, you've got to look in the .\win32gui\build_root\bin\boost\build_lib\libwin32gui.lib\vc7.1 subdir ...
BTW, if someone master bjam enough, I am interested in compiling win32gui with stlport...
There is no other version ;)
There only are two static libs (a debug version and a release version)
Compiling for stlport shouldn't be very difficult.
Look in build_root/build_lib.
create copies of the build-vc71.bat, build-vc71-w-version.bat.
Edit the latter, and instead of
"bjam -sTOOLS=vc7.1 "-sBUILD=debug release <runtime-link>static"
bjam -sTOOLS=msvc-stlport "-sBUILD=debug release <runtime-link>static"
I have not tested it though.
Anyway, as I've told others, I'm hating bjam more and more. I will create a replacement soon (hopefully should be ready by the end of this month). After that, compiling will be a bliss ;)
Have you looked at either Ant, nAnt, or perhaps MSBuild (too bad that's still in beta, because since this is a windows-only project, that'd be the way to go)?
There are a few good build systems out there, but I've never liked jam or bjam.
As far as I know, Ant is java-specific.
As MSBuild, should be MS specific ;)
Anyway, I will develop it using win32gui - and it will also be an example of how you can use win32gui features ;)