Re: Catching Glib::FileError when its thrown in a DLL



Hi,
If you are using gtkmm from this site 
http://ftp.gnome.org/pub/GNOME/binaries/win32/gtkmm/
you have to use MinGW64 compiler
http://mingw-w64.sourceforge.net/

You can also compile Gtkmm by oneself.

Best regards,
Adam

Dnia 2011-12-12, pon o godzinie 01:28 +0100, Nils Asmussen pisze:
> Hi all,
> 
> I'm building a cross-platform application using gtkmm. Currently I'm
> trying to get it working on Windows using Cygwin to build it. As it
> seems, catching exceptions that are thrown from the gtkmm-2.4 library
> doesn't work. I've build a small example program to demonstrate the
> problem:
> --------------
> #include <iostream>
> #include <glibmm/fileutils.h>
> using namespace std;
> int main() {
>   try {
>     throw Glib::FileError(Glib::FileError::NOT_ENOUGH_MEMORY,"Foobar");
>   }
>   catch(Glib::FileError& e) {
>     cout << "Catched " << e.what() << endl;
>   }
>   try {
>     Glib::Dir("Foobar");
>   }
>   catch(Glib::FileError& e) {
>     cout << "Catched " << e.what() << endl;
>   }
>   return 0;
> }
> --------------
> 
> I'm compiling it with:
> --------------
> $ g++ `pkg-config.exe --cflags gtkmm-2.4` -o test test.cpp
> `pkg-config.exe --libs gtkmm-2.4`
> --------------
> 
> The result is:
> --------------
> $ ./test.exe
> Catched Foobar
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> terminate called after throwing an instance of 'Glib::FileError'
> --------------
> 
> So, as soon as not my application but a shared library throws the
> exception, the catch-clause isn't found.
> I should note that it works fine on Linux. Am I doing something wrong?
> 
> Best regards,
> Nils
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]