Exception Handling switch gives linking problems

Danny Smith dannysmith@clear.net.nz
Tue Mar 9 02:09:00 GMT 2004


From: nirav dot dalal at teradyne dot com

------------------------------------------------------------------------
--------

> Hi,
>
> I'm having issues with GCC compiling & linking when I remove "
> -fno-exceptions"
> switches/option with x86 target.
>
> For example:
>
> Case A] This example works fine.
> >gcc -mdll -DBUILD_DLL -O3 -c -fno-exceptions foo.cpp
> >dllwrap --dllname=foo.dll foo.o
>
> Case B] This example compiles OK, but does NOT link.
> >gcc -mdll -DBUILD_DLL -O3 -c foo.cpp
> >dllwrap --dllname=foo.dll foo.o
>
> The "dllwrap" command gives me following error/s:
> foo.o(.text+0x28):foo.cpp: undefined reference to
`__gxx_personality_sj0'

< snip >

Tell dllwrap to link in libstdc++ by setting language to C++:

dllwrap --driver-name c++  --dllname=foo.dll foo.o


Better yet, use g++ -shared, instead of dllwrap,   to build the dll

g++  -DBUILD_DLL -O3 -c foo.cpp
g++ -shared -o foo.dll foo.o


Danny



More information about the Gcc-help mailing list