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 - the following form of the auxiliary pragma can be used to specify the http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The following form of the auxiliary pragma can be used to specify the
registers that are to be used to return a function's value.

+--------------------------------------------------------------------------+
|      #pragma aux sym value reg_set [;]                                   |
|                                                                          |
+--------------------------------------------------------------------------+

where
    description

sym
    is a function name.

reg_set
    is a register set.

Note that the method described below for returning values of type float or
double is supported only when the "fpc" option is used.

Depending on the type of the return value, only certain registers are
allowed in reg_set.

1-byte
    For 1-byte return values, only the following registers are allowed:  AL,
    AH, DL, DH, BL, BH, CL or CH.  If no register set is specified, register
    AL will be used.

2-byte
    For 2-byte return values, only the following registers are allowed:  AX,
    DX, BX, CX, SI or DI.  If no register set is specified, register AX will
    be used.

4-byte
    For 4-byte return values (including near pointers), only the following
    register are allowed:  EAX, EDX, EBX, ECX, ESI or EDI.  If no register
    set is specified, register EAX will be used.  This form of the auxiliary
    pragma is legal for functions of type float when using the "fpc" option
    only.

far pointer
    For functions that return far pointers, the following register pairs are
    allowed:  DX:EAX, CX:EBX, CX:EAX, CX:ESI, DX:EBX, DI:EAX, CX:EDI,
    DX:ESI, DI:EBX, SI:EAX, CX:EDX, DX:EDI, DI:ESI, SI:EBX, BX:EAX, FS:ECX,
    FS:EDX, FS:EDI, FS:ESI, FS:EBX, FS:EAX, GS:ECX, GS:EDX, GS:EDI, GS:ESI,
    GS:EBX, GS:EAX, DS:ECX, DS:EDX, DS:EDI, DS:ESI, DS:EBX, DS:EAX, ES:ECX,
    ES:EDX, ES:EDI, ES:ESI, ES:EBX or ES:EAX.  If no register set is
    specified, the registers DX:EAX will be used.

8-byte
    For 8-byte return values (including functions of type double), only the
    following register pairs are allowed:  EDX:EAX, ECX:EBX, ECX:EAX,
    ECX:ESI, EDX:EBX, EDI:EAX, ECX:EDI, EDX:ESI, EDI:EBX, ESI:EAX, ECX:EDX,
    EDX:EDI, EDI:ESI, ESI:EBX or EBX:EAX.  If no register set is specified,
    the registers EDX:EAX will be used.  This form of the auxiliary pragma
    is legal for functions of type double when using the "fpc" option only.

Notes:

 1. An empty register set is not allowed.

 2. If you are compiling for a memory model which has a small data model,
    any of the above register combinations containing register DS becomes
    illegal.  In a small data model, segment register DS must remain
    unchanged as it points to the program's data segment.

 3. If you are compiling for the flat memory model, any register combination
    containing DS or ES becomes illegal.  In a flat memory model, code and
    data reside in the same segment.  Segment registers DS and ES point to
    this segment and must remain unchanged.

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