Implementation of Services

The target function must be defined in a slightly different manner from the prototype provided in INTERFAC.H. The first argument of the actual function must be a structure (not a pointer to a structure) which is used to account for the additional stack space used between the initial call to c_service() and the arrival of control at the function itself.

struct dummy_space { 
     int space[C_INT_STACK_OVRHD]; 
}; 

C_INT_STACK_OVRHD is used to account for the extra elements on the stack between the current stack pointer and the first item of the argument list. This is currently 18 bytes.

Services use the stack of the calling application. When implementing services code in the C language, the compiler must be told that the stack and data segments will not be equal. This is done by using the /Aw switch.