MSVC first uses pointer comparison, and then, if that fails, compares the strings. You can see the implementation in the CRT VS2012 sources:
extern "C" _CRTIMP int __cdecl __TypeMatch( HandlerType *pCatch, // Type of the 'catch' clause CatchableType *pCatchable, // Type conversion under consideration ThrowInfo *pThrow // General information about the thrown // type. ) { // First, check for match with ellipsis: if (HT_IS_TYPE_ELLIPSIS(*pCatch)) { return TRUE; } // Not ellipsis; the basic types match if it the same record *or* the // names are identical. if (HT_PTD(*pCatch) != CT_PTD(*pCatchable) && strcmp(HT_NAME(*pCatch), CT_NAME(*pCatchable)) != 0) { return FALSE; } ...
Itanium ABI always uses only pointer comparisons. The way it should work with the DLL is that the dynamic loader must ensure that for each exception in the program address space there is a single instance of the typeinfo object.
If you are interested in actually implementing the RTTI exception and catch information, see my OpenRCE (MSVC) article and Recon 2012 presentation (GCC, MSVC x64).
source share