The OPTLINK convention has the following features:
- Parameters are pushed from right to left onto the stack.
- The caller cleans up the stack.
- The general-purpose registers EBX, EDI, and ESI are preserved
across the call.
- The general-purpose registers EAX, ECX, and EDX are not preserved
across the call.
- Floating-point registers are not preserved across the call.
- The three conforming parameters that are lexically leftmost
(conforming parameters are the addresses for all BYADDR parameters
and the following BYVALUE parameters: pointer, handle,
ordinal, offset, limited entry, real fixed binary, character(1),
and nonvarying bits occupying 1 byte or less) are passed in the
three unpreserved general-purpose registers.
- Up to four real floating-point or two complex parameters (the
lexically first four) are passed in extended precision format (80-bit)
in the floating-point register stack.
- All conforming parameters not passed in registers and all nonconforming parameters
are passed on the 80386 stack.
- Space for the parameters in registers is allocated on the stack,
but the parameters are not copied into that space.
- Conforming return values are returned in EAX.
- Real floating-point return values are returned in extended precision
format in the topmost register of the floating-point stack.
- Complex floating-point return values are returned in extended
precision format in the topmost two registers of the floating-point
stack.
- When you are calling external functions, the floating-point
register stack contains only valid parameter registers on entry,
and valid return values on exit.
- Functions returning aggregates pass the address of a storage
area determined by the caller as a hidden parameter. This area becomes
the returned aggregate. The address of this aggregate is returned
in EAX.
- The direction flag must be clear upon entry to functions, and
clear on exit from functions. The state of the other flags is ignored
on entry to a function, and undefined on exit.
- The compiler does not change the contents of the floating-point
control register. If you want to change the control register contents
for a particular operation, save the contents before making the
changes and restore them after the operation.