Used for establishing an OpenVMS exception handler for a particular routine. This function establishes a special DEC C RTL exception handler in the routine that called it. This special handler catches all RTL-related exceptions that occur in later routines, and passes on all other exceptions to your handler.
#include <signal.h> void VAXC$ESTABLISH (unsigned int (*exception_handler)(void *sigarr, void *mecharr));
You can only invoke the VAXC$ESTABLISH function from a DEC C for OpenVMS function, because it relies on the allocation of data space on the run-time stack by the DEC C compiler. Calling the OpenVMS system library routine LIB$ESTABLISH directly from a DEC C function results in undefined behavior from the setjmp and longjmp functions.
To cause an OpenVMS exception to generate a UNIX style signal, user exception handlers must return SS$_RESIGNAL upon receiving any exception that they do not want to handle. Returning SS$_NORMAL prevents the generation of a UNIX style signal. UNIX signals are generated as if by an exception handler in the stack frame of the main C program. Not all OpenVMS exceptions correspond to UNIX signals. See Chapter 4 for more information on the interaction of OpenVMS exceptions and UNIX style signals.
Calling VAXC$ESTABLISH with an argument of NULL cancels an existing handler in that routine.