Solved

dll exit routine

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now