Catching Glib::FileError when its thrown in a DLL



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



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