This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cannot catch exceptions thrown in a shared library under MS windows

Rüdiger Ranft wrote:

> The compilers I tried were g++-4.1.2 and g++-4.2.2, running unter cygwin
> with mingw32 target. The compilers where generated from vanilla sources,
> configure paramters are "../gcc-4.2.2/configure --host=i686-pc-cygwin
> --build=i686-pc-cygwin --target=i586-pc-mingw32
> --enable-languages=c,c++" and "../gcc-4.1.2/configure
> --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i586-pc-mingw32
> --enable-languages=c,c++" respectively.

You can't throw/catch across DLLs with static libgcc.  Stock FS gcc
cannot build shared libgcc on Cygwin or MinGW.  So this is pretty much
broken by design, unless you patch gcc to build libgcc shared, as in the
case of the 4.2 that is available on the MinGW site.

The 3.4 versions that Cygwin and MinGW ship have local patches to allow
exceptions across DLLs with static libgcc.  This patch is very ugly and
doesn't forward port to 4.x.

[ When people keep wondering why Cygwin doesn't ship gcc 4.x, this is
one of the reasons why. ]

> In the wiki I found that this problem is a result of different
> visibility models in gcc3 vs. gcc4, so I tried different compiler
> switches (-fvisibility=default), but did not get any running configuration.

That may also apply but it's not the reason why this does not work. 
Static libgcc is the reason.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]