[libxml++] Problem catching parser exceptions on Win32



I have a problem catching parser exceptions on Win32 (XP/msys/mingw/gcc). This is causing me difficuties with error handling in libglademm and also when using libxml++ directly. I've reproduced the problem in a minimal example.

The following code catches an exception OK when built and run on Debian etch, but fails to do so when built and run on XP SP2. Does anyone have any idea why or what I can do to fix it?

Here's the code:

include <iostream>
#include <libxml++/libxml++.h>

int main (int argc, char *argv[])
{
   xmlpp::DomParser parser;
    try {
      parser.parse_memory("xxxxxxxxx<root_node/>");
    }
    catch (...) {
        std::cerr << "Caught an exception from the parser." << std::endl;
    }
}

On Debian etch, the output is:

Entity: line 1: parser error : Start tag expected, '<' not found
xxxxxxxxx<root_node/>
^
Caught an exception from the parser.

On Win XP/msys, the output is:

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Entity: line 1: parser error : Start tag expected, '<' not found
xxxxxxxxx<root_node/>
^

Note that the exception hasn't been caught this time.

The Win 32 environment is:
Windows XP SP2
MSYS 1.0.11
MinGW 5.1.3
gcc 3.4.5
Gtk 2.10.11-1 (from gladewin32.sourceforge.net)
gtkmm 2.10.11-1 (from ftp.gnome.org)

The Debian build environment uses gcc 4.1.2 .

The build command line on Debian etch was:

gcc xmlpp_test01.cc -o xmlpp_test01 `pkg-config libxml++-2.6 --cflags --libs`

Replacing gcc with g++ works OK as well.

On Win XP/msys it was:

g++ xmlpp_test01.cc -o xmlpp_test01 `pkg-config libxml++-2.6 --cflags --libs`

Running it as gcc instead causes problems.

Any help will be much appreciated.

Tony Cowderoy




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