Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ User's Guide - (16-bit only) this option is similar to "zw" but causes the compiler to http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
(16-bit only) This option is similar to "zW" but causes the compiler to
generate "smart callbacks".  This option may be used for Microsoft Windows
user callback functions in executables only.  It is not permitted for DLLs.
Normally, a callback function cannot be called directly.  You must use
MakeProcInstance to obtain a function pointer with which to call the
callback function.
If you specify "zWs" then you do not need to use MakeProcInstance in order
to call your own callback functions.  Any functions declared as "far
_export" will be compiled with the "smart" prologue code sequence described
here.

The following example shows the usual prologue code sequence that is
generated when the "zWs" option is NOT used.

Example:

     compiler_name winapp /mc /bt=windows /d1

     short FAR PASCAL __export Function1( short var1,
                                          long varlong,
                                          short var2 )
     {
      0000  1e            FUNCTION1       push    ds
      0001  58                            pop     ax
      0002  90                            nop
      0003  45                            inc     bp
      0004  55                            push    bp
      0005  89 e5                         mov     bp,sp
      0007  1e                            push    ds
      0008  8e d8                         mov     ds,ax

The following example shows the "smart" prologue code sequence that is
generated when the "zWs" option is used.  The assumption here is that the SS
register contains the address of DGROUP.

Example:

     compiler_name winapp /mc /bt=windows /d1 /zWs

     short FAR PASCAL __export Function1( short var1,
                                          long varlong,
                                          short var2 )
     {
      0000  8c d0         FUNCTION1       mov     ax,ss
      0002  45                            inc     bp
      0003  55                            push    bp
      0004  89 e5                         mov     bp,sp
      0006  1e                            push    ds
      0007  8e d8                         mov     ds,ax

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson