Solved

dll exit routine

Posted on 1997-09-19
4
348 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need example 5 113
Changing the installation path of this MSI 5 102
Please explain "Promise Pattern" and how it's used 2 55
Windows ICD FFU Issue 4 38
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

776 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