Click here to Skip to main content
12,882,806 members (40,017 online)
Click here to Skip to main content


566 bookmarked
Posted 15 Apr 2002

How a C++ compiler implements exception handling

, 15 Apr 2002 CPOL
An indepth discussion of how VC++ implements exception handling. Source code includes exception handling library for VC++.
The directory contains three projects:

1)  MyExcHandler. This is built as static library.
2)  excptstorage. This is built as DLL.
3)  demo.         Showing how to use exception handler.

The following steps are needed to use my_exc_handler:

1)  Link with MyExcHandler.lib and excptstorage.lib.
2)  Make sure that excptstorage.dll is in your path.
3)  Set C runtime library to Multithreaded (for release) or Debug MultiThreaded (for DEBUG)



VC++ 5.0 <functional> header has a bug, which will give compilation error. There are two 

a) add 'const' qualfier to mem_fun1_t::operator() in <functional>
b) Replace the header <functional> with the one provided by VC++ 6.0

Primarily built with VC++ 6.0 on Windows 2000. It also works fine with VC++ 5.0 (after overcoming the compilation problem) and VC++ 7.0. There is small difference between 6.0 and 7.0. 6.0 first copies the exception (or its reference) on catch block's frame and then perfroms stack unwinding before calling catch block. 7.0 library first performs stack unwinding. The behavior of my library is similar to 6.0 library.

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Vishal Kochhar
Web Developer
Canada Canada
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170422.1 | Last Updated 16 Apr 2002
Article Copyright 2002 by Vishal Kochhar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid