Win64 exception handling

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at
Mon Mar 23 15:55:17 PDT 2015

Hi all,
   I have been trying to work on exception handling on Windows x64 
(with LLVM 3.6), but for a long time now, I am stuck on something 
perhaps very simple.

My test case is this program:
int main() {
     try {
         throw new Exception("johan");
     } catch (Exception jow) {
     return 0;

This crashes, and Visual Studio's debugger tells me it's because 
of an unhandled exception. As far as I understand it, we call 
RtlRaiseException() from _d_throw_exception() and that should 
call the personality function _d_eh_personality(). However, 
_d_eh_personality() is never entered. Instead, 
RtlRaiseException() returns and the program crashes. I am stuck 
on how to continue from here. I have tried many different things, 
but I cannot get the OS to call _d_eh_personality().

One thing that strikes me is that the exception code 
STATUS_LDC_D_EXCEPTION is passed to RtlRaiseException(), but is 
not used anywhere else in our source.
Does LLVM not correctly register _d_eh_personality() with the OS? 
Or is there some filtering done on the exception code?

I'd appreciate any help.


More information about the digitalmars-d-ldc mailing list