I am using Borland C++ Builder 4 and implementing a class library that has to be distributed as a set of .dll's.
I am using the generated import libraries to load the dll's at startup.
I am throwing an exception (of a class exported from general.dll and derived of stl exception) from library.dll and trying to catch this in app.exe when that calls a function in library.dll that causes this exception to be thrown ...
Problem is that the exception falls through my catch blocks into the catch for the base class (exception).
I have :
catch(const myException & E)
ShowMessage("Correct exception caught");
catch(const exception& E)
ShowMessage("Base exception caught");
ShowMessage(AnsiString("Class caught had name :") + typeid(E).name());
ShowMessage("Unexpected exception caught");
and I always end up in the base exception handler, with the name displayed being "myException".
It seems like the RTTI for exceptions is done differently from the RTTI provided via the typeid mechanism.
1)Any ideas how the RTTI is done in by Borland and why this is failing so miserably?
2)Has anyone else ever had similar problems using custom exceptions and dll's?