 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Fortunately,
our program can gain control by replacing
|
|
|
the
call to abort with a call to a function that we provide.
|
| • |
We
pass the address of our function to the library
|
|
|
function
set_terminate. The address of the previous
|
|
|
function
is returned and the address we pass is saved in
|
|
|
its
place.
|
|
| • |
Whenever
terminate is called, our function will also be
|
|
|
called.
|
|
|
void
user_terminate() {...) //user
supplied terminate
|
|
|
int
main() {
|
|
set_terminate(user_terminate); //install
user function
|
|
...
|
|