Author Topic: VS settings for creating smallest application?  (Read 3312 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
hi guys...
can someone of you tell me, what options/settings must/should be changed in VS2005/VS2008 to produce the smallest unpacked and legal Win32 executeable? This has nothing directly to do with intro coding... just would like to have a tiny framework for creating no bloody GUI appz and know how and where to change the settings ^^ thx

example source with prj file attached...
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: VS settings for creating smallest application?
« Reply #1 on: January 20, 2009 »
@va!n:
I do not know any software development field in which
they focused as much on size reducing a window exe as
they do in the scene. Since you already released some
tiny production - I guess you know all the compiler settings
already.

Just don't include what you do not need if you want to
aim for anything else than a graphic fx exe.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1435
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: VS settings for creating smallest application?
« Reply #2 on: January 20, 2009 »
@benny:
i have tried to play a bit with the compiler settings to reduce its size... no luck...
and i have tried to use the DX framework for GUI coding but has some probs...

however, using a framework with a given projectfile is nice but personally i would like to know / learn now, what and where to change settings... for example i have tried to replace on working sources the "WindowsMainCRTStartup" by "WinMain" but then i ended in lot of errors... so i dont really know the different and what i have to check when doing this.

At least i think it makes more sence when me and possible other guys know where and what settings they can/should use instead just using a given project file...

- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: VS settings for creating smallest application?
« Reply #3 on: January 20, 2009 »
4Kb is the smallest 'valid' Windows exe.

To make things small, you need to turn on optimise for size, turn off link time code generation, and turn off default libraries in the compiler and linker.

main() is the entry point for Win32 Console apps
WinMain() is the entry point for Win32 windowed apps.

If you're not using the C runtime (ie. no default libraries) then the entry points are
mainCRTStartup()
WinMainCRTStartup()

If you're coding C then make sure your files end with .c
If you're coding C++ then make sure your files end with .cpp

If you want DirectX then you need to go into the linker settings and add to the additional libraries.
Usually you need d3d9.lib.
Other ones might be opengl32.lib winmm.lib dxguid.lib d3dx9.lib depending what you want.

Jim
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: VS settings for creating smallest application?
« Reply #4 on: January 20, 2009 »
@va!n:
Ok .. fair enough.

This might be a bit outdated (VC6.0) but maybe it
helps a bit, too.

http://www.hailstorm.net/papers/smallwin32.htm#compiler
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won: