[Expat-discuss] c++-ize expat

m. michal017 at centrum.sk
Wed Jun 25 08:54:55 EDT 2003


You know what? You are entirely right..
This information was based on my colleague's knowledge, I should have tested
it before I posted a question.. My apologies
michal

On Tue, 24 Jun 2003 23:29:01 +0100
Graham Bennett <graham-expat at simulcra.org> wrote:

>On Tue, Jun 24, 2003 at 02:38:21PM +0200, m. wrote:
>> Hello..  I am wondering whether it is possible to c++-ize expat's code
>> so that it could be compiled with c++ compiler.  The reason for this
>> is the ability to throw exceptions from callback functions.  I have to
>> remove all the 'extern "C"' stuff from expat code and cast all the
>> void* to FILE* and so on..  Could this be done in the default expat's
>> code?
>
>In order to use expat from C++ code it is not necessary to compile with
>g++.  All that you need is to compile with gcc with the -fexceptions
>flag.  This generates the necessary stack unwinding code to allow
>exceptions to be thrown.
>
>IIRC, the expat configure script will enable the -fexceptions flag if it
>detects the compiler is gcc (even though it checks for -fno-exceptions).
>Try it and see.
>
>I have used expat from C++ code compiled in this way and I've had no
>problems throwing exceptions through expat code.
>
>cheers,
>
>-- 
>Graham Bennett
>
>



More information about the Expat-discuss mailing list