[xml] singularity in using C++ exceptions with libxml2 library
- From: Nathan Myers <ncm-xml cantrip org>
- To: xml gnome org
- Subject: [xml] singularity in using C++ exceptions with libxml2 library
- Date: 30 Aug 2002 16:02:50 -0400
Stanislav Ievlev <inger altlinux org>
libxml2 needs rebuild with '-fexceptions' to avoid problems with
exceptions catching.
Attached program is a test to this problem.
With libxml compilled without "-fexceptions" this program cannot catch
exception from aborter() function
You cannot safely throw a C++ exception out of a callback called
from C code unless the C library involved was specifically designed
to allow it. It doesn't matter what compiler flags you use.
(Also note, it's generally very difficult to allow it and typically
not practical.)
You have to catch the exception in the callback, pass status back
up the line (in this case by telling the SAX parser to stop parsing,
and setting some private field in your parse context) and then
returning normally.
Sorry, but that's the way it is.
Nathan Myers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]