Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7887
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: exception problem with cygwin - terminate called recursively |
| Date | 2011-07-16 23:59 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <ivt1ke$3k4$1@online.de> (permalink) |
| References | (1 earlier) <27226563-9435-441f-a626-08e3ae85f811@glegroupsg2000goo.googlegroups.com> <ivs5ac$c5s$1@online.de> <Xns9F24C20FD35B8myfirstnameosapriee@216.196.109.131> <ivsj85$njn$1@online.de> <Xns9F24EE788D51Bmyfirstnameosapriee@216.196.109.131> |
On 2011-07-16 22:26:34 +0200, Paavo Helde said:
> Philipp Kraus <philipp.kraus@flashpixx.de> wrote in
> news:ivsj85$njn$1@online.de:
>
>> On 2011-07-16 18:04:37 +0200, Paavo Helde said:
>>
>>> Philipp Kraus <philipp.kraus@flashpixx.de> wrote in news:ivs5ac$c5s$1
>>> @online.de:
>>>
>>>> I'm a little bit closer on the problem context, I have mixed C and
>>>> C++ code in the class that throws the exception.
>>> [...]
>>>> problem. I try to recompile my sources with the -fexceptions flag,
>>>> but that does not wort. Shoud I compile my C libraries with the
>>>> flag?
>>>
>>> The -fexceptions flag should not have any effect on C++ code
>>> whatsoever. You need this for compiling any C code which is supposed
>>> to let C++ exceptions propagate through it. On Windows platform MSVC
>>> implements exceptions at the OS level so there is no such special
>>> flag needed for C code, but things may be different with cygwin or
>>> gcc.
>>
>> I think this question is off-topic, but do you know a working solution
>> for g++? I have compiled all my libraries and my code with g++ / gcc,
>> so should I set the
>> -fexceptions flag on each library or only on my code?
>
> I don't know if this is off-topic or not, there is too less information.
> For example it is not clear what you mean exactly by "mix of C and C++ in
> the class" and if "your code" is C or C++. Maybe you could post a minimal
> example demonstrating the problem?
It's very simple. I use the libxml2 functions for parsing XML data. The library
have some error function / callback function for detecting errors
during the parsing.
eg:
my xmlclass {
public:
doxml( std::string p_xml ) {
xmlParseMemory(p_xml.c_str)
if (xmlErrorDetect()) {
xmlClear()
throw std::runtime_error("error")
}
}
}
In my main function
{
myxmlclass obj;
try {
obj.doxml("abcdef");
} catch (...) {
std::cout << "exception is caught" << std::endl;
}
}
The calls with xml prefix are the calls of the libxml2. I have checked
with gdb, the throw will be called, but not caught in the main. I can
change
the (...) to anything, but I can't catch the exception. I have tested
with std::exception, own exception, that derivated from std::exception.
Under
the Cygwin g++ I can't catch it, same code under OSX and Linux works
fine, the exception is caught and I can handle it.
> All I know that with Linux and gcc, all C code which has to be able to
> propagate exceptions through it must be compiled with -fexceptions.
The -fexceptions is enabled on default, so I think its correct.
I do not understand where the problem is and how I can solve it
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: exception problem with cygwin - terminate called recursively peter koch <peter.koch.larsen@gmail.com> - 2011-07-14 09:00 -0700
Re: exception problem with cygwin - terminate called recursively Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-14 18:11 +0200
Re: exception problem with cygwin - terminate called recursively Ian Collins <ian-news@hotmail.com> - 2011-07-15 07:36 +1200
Re: exception problem with cygwin - terminate called recursively Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-16 15:56 +0200
Re: exception problem with cygwin - terminate called recursively Paavo Helde <myfirstname@osa.pri.ee> - 2011-07-16 11:04 -0500
Re: exception problem with cygwin - terminate called recursively Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-16 19:54 +0200
Re: exception problem with cygwin - terminate called recursively Paavo Helde <myfirstname@osa.pri.ee> - 2011-07-16 15:26 -0500
Re: exception problem with cygwin - terminate called recursively Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-16 23:59 +0200
Re: exception problem with cygwin - terminate called recursively Paavo Helde <myfirstname@osa.pri.ee> - 2011-07-16 17:39 -0500
Re: exception problem with cygwin - terminate called recursively Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-17 01:17 +0200
Re: exception problem with cygwin - terminate called recursively Paavo Helde <myfirstname@osa.pri.ee> - 2011-07-17 02:30 -0500
Re: exception problem with cygwin - terminate called recursively Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-07-17 11:18 +0200
csiph-web