KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q58489: Tips for Reducing Prolog/Epilog Code in Windows or PM Apps

Article: Q58489
Product(s): See article
Version(s): 6.00    | 6.00
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 18-APR-1990

-Gq was a secret switch in C Version 5.10 to generate a reduced
Windows prolog/epilog code sequence for routines that were not
"callbacks"; it was identical in functionality to the new (documented)
-GW switch.

The table below lists the changes to the command line when compiling
with C Version 6.00. The first column (Old Way) lists switches as
recommended by Charles Petzold in "Programming the OS/2 Presentation
Manager" and "Programming Windows." The second column is the new
recommended way.

Presentation Manager
--------------------

                     Old Way           New Way
                     -------           -------

   User code         -Gw               ---
   User callback     -Gw _export       _loadds

   DLL entry         -Au _export       -Aw _loadds _export
   DLL internal      -Au               -Aw

Windows
-------

   User code         -Gw               -GW
   User callback     -Gw _export       (unchanged)

   DLL entry         -Gw -Aw _export   (unchanged)
   DLL internal      -Gw -Aw           -GW -Aw

Windows Notes:

1. You also need -Zp.

2. Winmain is a special case and should be -Gw _export, not -GW.

3. By using _export you don't need a def file; however, there are
   other advantages to using a def file. For example, you can export
   your entry points by number instead of by name, saving space in the
   resident name table and making more space for your application.

4. Other references claim you should use -Au (equivalent to -Aw +
   _loadds); we claim the _loadds is not needed for windows since they
   all have a special DS sequence.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.