Microsoft KB Archive/47690

Don’t EXPORT PM Window and Dialog Procedures PSS ID Number: Q47690 Article last modified on 03-08-1990 PSS database name: O_Os2PrTk

1.10

OS/2

Summary:

Presentation Manager (PM) window and dialog procedures should NOT be exported if you are building your programs with the Microsoft C Compiler Version 5.10 or later. Instead, those procedures should be declared _loadds. The best thing to do is to modify the definition of EXPENTRY in OS2DEF.H to the following:

Then, remove all window and dialog procedures from the .DEF file. This will improve system performance by removing unnecessary call gates.
 * 1) define EXPENTRY pascal far _loadds

Most existing Presentation Manager documentation is incorrect on this point. There were two reasons, which are no longer valid, for exporting window procedures:

  Presentation Manager needs to call back the procedure. But an export is unnecessary because Presentation Manager gets the address from WinRegisterClass.   The procedure needs to get its DS value set to the program’s own DGROUP, and the loader used to patch the prolog of exported entry points, to make this happen. However, this is exactly what _loadds now does: mov ax,DGROUP mov ds,ax 

Exporting these procedures will not break the program (obviously, most Presentation Manager programs are still built with exports), but it will add unnecessary call gates to the system.

Copyright Microsoft Corporation 1990.