Installs your own termination function to be called by unexpected.
The set_unexpected function installs unexpFunction as the function called by unexpected. unexpected is not used in the current C++ exception-handling implementation. The unexpected_function type is defined in EH.H as a pointer to a user-defined unexpected function, unexpFunction that returns void. Your custom unexpFunction function should not return to its caller.
typedef void ( *unexpected_function )( );
By default, unexpected calls terminate. You can change this default behavior by writing your own termination function and calling set_unexpected with the name of your function as its argument. unexpected calls the last function given as an argument to set_unexpected.
Unlike the custom termination function installed by a call to set_terminate, an exception can be thrown from within unexpFunction.
In a multithreaded environment, unexpected functions are maintained separately for each thread. Each new thread needs to install its own unexpected function. Thus, each thread is in charge of its own unexpected handling.
In the current Microsoft implementation of C++ exception handling, unexpected calls terminate by default and is never called by the exception-handling run-time library. There is no particular advantage to calling unexpected rather than terminate.
There is a single set_unexpected handler for all dynamically linked DLLs or EXEs; even if you call set_unexpected your handler may be replaced by another or that you are replacing a handler set by another DLL or EXE.
For additional compatibility information, see Compatibility in the Introduction.
Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.