?
Solved

dll exit routine

Posted on 1997-09-19
4
Medium Priority
?
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
msmits earned 100 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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…
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 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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

770 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