Solved

dll exit routine

Posted on 1997-09-19
4
346 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Visual Fox Pro commands 15 27
Does Microsoft Office 2016 support COM/ActiveX? 3 69
TFS Branching 4 63
Dialogbox API leak? 18 59
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 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

13 Experts available now in Live!

Get 1:1 Help Now