Strange behaviour in VC 7.1

A

Alfonso Morra

Hi,

I have written a simple test harness (exe) for a C++ (native) DLL that
exports some C++ objects. The objects throw exceptions when they an
error occurs in the Ctor, and the test harness is supposed to catch the
exception.

I have noticed that when I am debugging the DLL (i.e. using the test
harness executable as the app to call the DLL), the exceptions are
caught (as expected), in the test harness code. However, when I am
debugging the test harness application (i.e. simply stepping through the
code of the test harness), the exceptions are not being caught. Has
anyone come across this before - is this a "feature" or a bug?
 
W

William DePalo [MVP VC++]

Alfonso Morra said:
I have written a simple test harness (exe) for a C++ (native) DLL that
exports some C++ objects. The objects throw exceptions when they an error
occurs in the Ctor, and the test harness is supposed to catch the
exception.

I have noticed that when I am debugging the DLL (i.e. using the test
harness executable as the app to call the DLL), the exceptions are caught
(as expected), in the test harness code. However, when I am debugging the
test harness application (i.e. simply stepping through the code of the
test harness), the exceptions are not being caught. Has anyone come across
this before - is this a "feature" or a bug?

As always the devil is in the details. What kind of exceptions are we
talking about and how are you catching them?

If you are mixing Win32 structured exceptions (via __try/__except) and C++
typed exceptions (via try/catch) it is entirely possible that you will see
different behavior in release and debug builds.

But there is not much point in waxing technical on this point unless that's
what you are doing.

Regards,
Will
 
A

Alfonso Morra

William said:
As always the devil is in the details. What kind of exceptions are we
talking about and how are you catching them?

If you are mixing Win32 structured exceptions (via __try/__except) and C++
typed exceptions (via try/catch) it is entirely possible that you will see
different behavior in release and debug builds.

But there is not much point in waxing technical on this point unless that's
what you are doing.

Regards,
Will

I managed to get this sorted. It was a bit of a red herring. The problem
was that the different projects were using libraries in different
folders - so my latest code changes were not being reflected in one of
the DLLS (the one that was being loaded fro the test harness). once I
deleted the offending DLL and change dthe paths - everything is OK.
Thanks anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top