[odb-users] ODB exception problem

cetoni GmbH - Uwe Kindler uwe.kindler at cetoni.de
Fri Jun 10 07:20:10 EDT 2011

Hi Boris,

thank you for the response.

We use the MinGW  build with GCC 4.5.1 from here (now there is already 
the version 4.5.2 available but we still use 4.5.1):


Like I mentioned it in my last mail we use this MinGW version since over 
a year now without any trouble. Our projects are plugin based and use 
DLLs extensively and we never had any problems throwing and catching 
exceptions across DLL boundaries so this is quite strange.

This is what the compilers readme file says about exceptions and DLLs:

*** Exceptions and DLLs ***

With the advent of the GCC 4.5 release series, the mingw32 port finally 
fully the same method every other platform uses to allow exceptions to 
out of shared libraries (DLLs): gcc library DLLs. For any GCC language that
supports exceptions (and DLLs), this method requires the runtime 
presence of two
additional DLLs: (1) libgcc_s*.dll, which contains common core data, and 
(2) a
language-specific DLL.

However, TDM-GCC also continues to integrate a versioned shared memory 
for the *static* (non-DLL) runtime libraries, which will still allow you to
throw exceptions between any DLLs or executables that are built with 
This method incurs a very small execution overhead as compared to the shared
library method, but has the very important benefit of not requiring you to
redistribute extra DLLs with your program.

By default, TDM-GCC will continue to create executables and DLLs that 
use the
static libraries and do not require you to redistribute further DLLs. If you
would like to use the shared libraries, you should add "-shared-libgcc" 
to the
command line to use a shared version of libgcc, and additionally ensure 
that the
shared version of your language-specific runtime library is being used. 
For C++,
add "-shared-libstdc++".

You cannot use a shared version of libgcc with a static version of a 
specific runtime. The reverse -- static libgcc with shared language-specific
runtime -- should work fine.

 From reading this documentation it should be possible to throw 
exceptions even if we do not use shared versions of libgcc and 
libstdc++. I modified the ODB example under 
odb-examples-1.4.0/schema/custom to throw an exception and it shows the 
same behaviour - the exception is not caught. Now I'm going to try to 
use the shared versions and will tell you about the results.


More information about the odb-users mailing list