Solved

dll exit routine

Posted on 1997-09-19
4
350 Views
Last Modified: 2013-12-03
How can I register an exit routine for my dll and ensure it would be run for all ABNORMAL process terminations?  I cannot use try, catch method because this only handles synchronous cases.  I need some way to be notify of termination regardless which part of the code is excuting at the time of the exit, something like a signal handler?
0
Comment
Question by:chanandrew
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
msmits earned 50 total points
ID: 1406933
I believe there is no generic solution to this problem. What you could try is writing some 'dr watson' like utility that knows about your program and kills the DLL's you are using when your program does an abnormal termination.

There is no way to catch you program internally when it goes off the deep end through some kind of GPF or something like that.
0
 

Author Comment

by:chanandrew
ID: 1406934
What about using set_terminate(terminate_function term_func)?  Would the term_func gets called for all abnormal termination??
0
 
LVL 3

Expert Comment

by:msmits
ID: 1406935
I could not find that function. Which API is it in?
I imagine that it is similar to the at_exit function and the registered functions with that are only called when the programs terminate via exit or falling of the end of main.

0
 

Author Comment

by:chanandrew
ID: 1406936
The function prototype can be found in the "eh.h" file.  This function is also mentioned in the on-line documentation.  However, I am still not very sure exactly when it will be called.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question