### #pragma handler (OS/2, Windows)

The #pragma handler directive registers an exception handler for a function.

    >>---#---pragma--handler--(--function----------------------------)--><
                                           \-,--exception_handler-/

The function is the name of the function for which the exception handler is to be registered. You should declare it before you use it in this directive.

The #pragma handler directive generates the code at compile time to install the IBM C and C++ Compilers exception handler _Exception before starting execution of the function. It also generates code to remove the exception handler at function exit.

You must use this directive whenever you change library environments or enter a user-created DLL.

You can remap the _Exception exception handler to another name with exception_handler, where exception_handler is the name of the function you provide that will be the exception handler for the named function.

Note: If you are using the subsystem libraries, the _Exception function is not provided.

To use the #pragma handler directive in a subsystem, you must provide your own exception handler named _Exception.