The issue on win32 with mingw is in some way the cross shared libraries  
exception problem, I installed a try {} catch(...){} inside Fl::handle and  
it catches my exceptions there.

It seems that in some way we need to have an option to override Fl::handle  
to catch exceptions before pass control back to windows operating system  
again, Fl::handle is static an probably it should be a method pointer to  
allow chaining event listeners.

typedef int (*Fl::handler_func)(int, Fl_Window*);

En 19/01/2011 10:04:27, Domingo Alvarez Duarte <[email protected]>  
escribió:

> I'm trying to handle exceptions on a fltk application under win32 and  
> compiled with mingw 4.5.2 but it seems that the exceptions doesn't reach  
> the main function, the program allways terminate without the exception  
> been caught.
>
> Someone else succeed catching exceptions or have a good strategy to  
> mange errors with exception when programming with fltk ?
>
> I've compiled fltk without "-fno-exceptions" and my entry code is this:
>
> -----
>
> #include "app.h"
> #include "sqlite3.h"
> #include "i18n_function.h"
>
> int main(int argc, char **argv)
> {
>      sqlite3_enable_shared_cache(1);
>      Fl_Input::default_number_format("\2,.");
>
>      try
>      {
>          load_translations();
>
>          //Fl::scheme("plastic");
>          Fl::scheme("gtk+");
>          //use partial match to find verdana font
>          //Fl::visual(FL_RGB);
>          //fltk.fl_register_images()
>          set_app_font("erdana");
>
>          Fl::add_focus_changing_handler(&fltk_Focus_Changing_Handler);
>
>          //sqlite3 *db;
>          //sqlite3_open("dadbiz.db", &db);
>          MainWindow *win = new MainWindow();
> #ifdef WIN32
>          void *icon = (void *)LoadIcon(fl_display, "APP_ICON");
>          if(icon) win->icon(icon);
> #endif
>          win->show(argc, argv);
>          return Fl::run();
>          delete win;
>          //sqlite3_close(db);
>      }
>      catch(CppSqlException &e) //till now never caught
>      {
>          printf("%s\n", e.errorMessage());
>          fl_alert(e.errorMessage());
>      }
>      catch(...) //till now never caught
>      {
>          printf("catch(...)\n");
>          fl_alert(_tr("Something unexpected happened, please ask your  
> provider !"));
>      }
> }
> -------
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to