WIN32_MEAN_AND_LEAN

Started by
4 comments, last by Cygon 19 years, 1 month ago
is there any other defs. like WIN32_MEAN_AND_LEAN that can be used to reduce building time? How do i use the NO... (NOSOUND,NOMSG,NOHELP,etc) defs. in a correct way?
Advertisement
There are also:

WIN32_EXTRA_LEAN
VC_EXTRA_LEAN

I'm not exactly sure what they remove from the headers though.

sam.
These days, people don't really use those defs, at least when compiling under Visual Studio. Precompiled headers provide more of a speedup than LEAN_AND_MEAN ever could. If you aren't using them, start.
Why not? If you can cut out garbage from the PCH, much the better. It isn't too much trouble, and a proxy header (that in turn includes windows.h) is useful anyway to set WINVER consistently, and work around missing or incorrect definitions (e.g. in dbghelp and powrprof).

Relevant parts of such a header:
#define WIN32_LEAN_AND_MEAN#define VC_EXTRALEAN#define NOGDICAPMASKS       // CC_*, LC_*, PC_*, CP_*, TC_*, RC_//#define NOVIRTUALKEYCODES // VK_*//#define NOWINMESSAGES     // WM_*, EM_*, LB_*, CB_*//#define NOWINSTYLES       // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*#define NOSYSMETRICS        // SM_*#define NOMENUS             // MF_*#define NOICONS             // IDI_*#define NOKEYSTATES         // MK_*//#define NOSYSCOMMANDS     // SC_*#define NORASTEROPS         // Binary and Tertiary raster ops//#define NOSHOWWINDOW      // SW_*#define OEMRESOURCE         // OEM Resource values#define NOATOM              // Atom Manager routines//#define NOCLIPBOARD       // Clipboard routines#define NOCOLOR             // Screen colors//#define NOCTLMGR          // Control and Dialog routines#define NODRAWTEXT          // DrawText() and DT_*//#define NOGDI             // All GDI defines and routines//#define NOKERNEL          // All KERNEL defines and routines//#define NOUSER            // All USER defines and routines#define NONLS               // All NLS defines and routines//#define NOMB              // MB_* and MessageBox()#define NOMEMMGR            // GMEM_*, LMEM_*, GHND, LHND, associated routines#define NOMETAFILE          // typedef METAFILEPICT#define NOMINMAX            // Macros min(a,b) and max(a,b)//#define NOMSG             // typedef MSG and associated routines#define NOOPENFILE          // OpenFile(), OemToAnsi, AnsiToOem, and OF_*#define NOSCROLL            // SB_* and scrolling routines#define NOSERVICE           // All Service Controller routines, SERVICE_ equates, etc.//#define NOSOUND           // Sound driver routines#define NOTEXTMETRIC        // typedef TEXTMETRIC and associated routines//#define NOWH              // SetWindowsHook and WH_*#define NOWINOFFSETS        // GWL_*, GCL_*, associated routines//#define NOCOMM            // COMM driver routines#define NOKANJI             // Kanji support stuff.#define NOHELP              // Help engine interface.#define NOPROFILER          // Profiler interface.#define NODEFERWINDOWPOS    // DeferWindowPos routines#define NOMCX               // Modem Configuration Extensions#include <windows.h>

Simply comment out a define if you end up needing what it removes.
E8 17 00 42 CE DC D2 DC E4 EA C4 40 CA DA C2 D8 CC 40 CA D0 E8 40E0 CA CA 96 5B B0 16 50 D7 D4 02 B2 02 86 E2 CD 21 58 48 79 F2 C3
Thanx jan thats what what i needed to know. But, what about using precompiled headers, is this done by using the /YX switch in the project settings?
Yes. It works like this:

- You create a special header file which includes all those large, seldomly changed headers like windows.h, d3d9.h, my_huge_library.h. The assistant from VisualC++ calls this precompiled header file stdafx.h

- The first non-blank, non-comment line of any source files (*.c, *.cpp) should be an include directive which includes the precompiled header file

- For the entire project, set /Yu to use the precompiled header file

These three steps can also be skipped and instead /YX be used to let the compile automatically include the precompiled header file - beware, however, that you project then won't compile anymore on compilers not having precompiled header support.

- Final step is to create a matching source file to include your precompiled header file and set, for this source file only, the precompiled header setting to "create precompiled header file".

The compiler will when compile this source file before any others and use it to create precompiled headers in a large file that can for all other files in a project be re-used, so all those large headers don't have to be parsed over and over.

-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.

This topic is closed to new replies.

Advertisement