LibEV and C++ exception pass through

David Imhoff dimhoff_devel at
Tue Aug 21 16:00:28 CEST 2012


I just wanted to share this, because I couldn't find any messages about 
this problem on the list.

When running the below code on a x86 machine, the exception is not 
caught. Instead the program will abort and core dump. On amd64 however 
this code does works as expected.

I found that compiling libev with the '-fexceptions' flag solves this 
issue for GCC.

I don't know how other compilers/platforms deal with this.

Kind regards,


#include <iostream>
#include "ev++.h"

using namespace std;

void throw_except(ev::timer &w, int revents)
         throw int(1);

int main()
         ev::timer timer1;
         timer1.start(0, 0);

         try {
                 ev_run(EV_DEFAULT, 0);
         } catch (...) {
                 cout << "caught exception" << endl;

         return 0;

More information about the libev mailing list