DOC: /GD and /Au Are Incompatible

ID: Q85504

The information in this article applies to:

SUMMARY

There is a documentation error relating to the use of Windows entry/exit code optimization switches for Microsoft C/C++ versions 7.0 and 8.0 in the Windows version 3.1 Software Development Kit (SDK) online Programming Tips help file. The help file states the following:

   Use the -Gw compiler switch to generate Windows prolog and epilog
   code for FAR functions under C 6.x. Under C 7.0, optimized
   prolog/epilog code can be generated using the /GD switch. The
   prolog code is not required when a DLL will be used only in
   protected mode. The only restriction is that exported FAR functions
   must explicitly reload DS when called. This code can be generated
   by two methods:

   1. Use the -Au switch on the Microsoft C compiler command line.
      This will generate a load for DS for each FAR function.

   2. Use the _loadds attribute for exported functions as demonstrated
      below:

         BOOL FAR PASCAL _loadds ExportedFunction(VOID)

Item number 1 is incorrect if you are using the /GD option.

MORE INFORMATION

Using /GD and /Au together generates the following error:

   Command line error D2016 :
   /GD and /Au command-line options are incompatible

The /GD switch implies /Aw, and therefore there is a conflict between the /GD and /Au options.

The /GD option along with the /GEf option will force all __far functions to load DS. The /GEf is not needed if all functions that are to be exported use the __export qualifier.

NOTE: The Programming Tips help file shows the __loadds keyword with only one underscore. This still works for backward compatibility; however, for strict ANSI compliance you should use two underscores.

Additional query words: 1.00 1.50 7.00 8.00 8.00c loadds entry exit Keywords : kb16bitonly

Last Reviewed: November 12, 1998