[Home]
[Search]
[Contents]
-WA Win32 EXE -WD Win32 DLL no -W switch Win32 console EXE app
-W{0123ADabdefmrsuvwx-+}
-W Same as -W1 if no modifier switches
-W- Not a windows compile (default)
-W1 Real mode Windows app/DLL
-W2 Real mode Windows app/DLL with exported and
callback functions marked with __export
-W3 Real mode Windows app with smart callbacks
-WA Protected mode Windows EXE, with callback functions
all marked as __export.
-WD Protected mode Windows DLL, with callback and exported
functions all marked as __export.
Modifiers:
a Reload DS from DS for far functions
b Assume DS != DGROUP
d Reload DS from DGROUP for far functions
e Generate EXPDEF records in .OBJ file for __export functions
f Mark all far functions as __export
m Generate INC BP / DEC BP to mark far stack frames
r Generate reload of DS only if __export or __loadds functions
s Reload DS from SS for far functions (smart callbacks)
t Use fixups instead of CS. This is needed for real mode,
where selector values can change as code moves around.
u Reload DS from DGROUP for near and far functions
(same as -mu) (same as marking all functions as __loadds)
v Save/restore caller's DS in far functions
w Assume SS != DS (same as -mw)
x Program will be run under Windows
- Turn off subsequent modifiers
+ Turn on subsequent modifiers
Modifers a,d,s,v are mutually exclusive.
Equivalents:
-W1 -Wtxema -D_WINDOWS
-W2 -Wtxemar -D_WINDOWS
-W3 -Wtxems -D_WINDOWS
-WA -Wtxrs -D_WINDOWS
-WD -Wtxerdw -D_WINDOWS -D_WINDLL
-WD-r -Wtxedw -D_WINDOWS -D_WINDLL
MSC SC/C++ --------------- -Gw -W Full Windows prolog/epilog for far functions -GW -W2 Reduced prolog/epilog, Note 1 -Au -mwu assume SS != DS and load DS on each function -Aw -mw assume SS != DS Note 1: SC/C++ will still generate the full prolog/epilog for __far __export functions, MSC6 will not.
MSC SC/C++ --------------- -Gw -W Full Windows prolog/epilog for far functions -Au -mwu assume SS != DS and load DS on each function -Aw -mw assume SS != DS -GA -WA optimized protected mode Windows apps -GD -WD optimized protected mode Windows DLLs -GEa -Wa load DS from AX -GEd -Wd load DS from DGROUP -GEe -We emit EXPDEF records for all exported functions -GEf -W-r create prolog/epilog code for all far functions -GEm -Wm add inc BP / dec BP to prolog / epilog of far functions -GEr -W2v real mode, reduced prolog for non-exported functions -GEs -Ws load DS from SS -Gq -Wtxme compatibility with MSC6 -GW -GW -Wtxmev -D_WINDOWS reduced prolog for real mode Windows functions
A DGROUP fixup can be triggered (in large data model) by things like:
static int x; static int *px = &x; /* DGROUP fixup generated */ static char *p = "abc"; /* DGROUP fixup generated */To get rid of the fixup, the pointers can be made near:
static int __near *px = (int __near *)&x; static char __near *p = "abc";these will generate DGROUP relative fixups, not DGROUP segment fixups. Alternatively, the pointers can be initialized at runtime (the compiler generates code that uses DS to initialize segment values).
Eliminating DGROUP segment fixups is useful for:
Note that -Wb will issue errors if you are using __loadds (because DS is reloaded from DGROUP) or if you are using -Wd (load DS from DGROUP Windows prologs).
-W tells the compiler to ignore case when linking to make the programs more compatible with existing Windows programs (many of which are linked that way). When developing new programs, do not ignore case, since C and C++ are case-sensitive languages. Ignoring case can cause bugs that are difficult to trace.
To compile a Windows program without ignoring case, use the options -W -L/noi
sc -W -L/noi winprog.c