[odb-users] ODB exception problem

Boris Kolpackov boris at codesynthesis.com
Fri Jun 10 05:31:01 EDT 2011


Hi Uwe,

cetoni GmbH - Uwe Kindler <uwe.kindler at cetoni.de> writes:

> So it seems like it is not possible to catch exceptions thrown from  
> libodb because normally the application should run into the first catch  
> block because odb::schema_catalog::create_schema (*db) throws an  
> unknown_schema exception like it happens if I insert the throw  
> odb::unknown_schema("Test") command . This is quite strange because we  
> use DLLs extensively and never discovered such a problem.

I was quite surprised to hear that this doesn't work for you because
some of our tests cause libodb to throw exceptions and these tests
catch them on MinGW without any problems. I also modified one of
the examples to cause libodb to throw unknown_schema and I was
able to catch this exception as well.

I think the problem is with your MinGW GCC toolchain (or its configuration).
To run our tests, we use the GCC build that comes with ODB (in fact, the
ODB Windows distribution includes a fairly complete MinGW+MSYS system
in the mingw/ subdirectory; you can start the shell by running msys.bat
found in this subdirectory).

So one thing that you may want to try is to rebuild your code with our
GCC and see if it makes a difference. If it does, then you will need to
see what is different between our build of GCC and the one you are using.

One potentially relevant bit of information that I found on the MinGW
wiki GCCStatus page[1] is that in order for exceptions to work cross-
DLL boundaries, each DLL and the executable should link to the DLL
version of libgcc. Perhaps you GCC comes only with a static version
or links to the static version by default. You may want to try the
-shared-libgcc option to force the use of the shared libgcc, as
suggested on the above page.

[1] http://www.mingw.org/wiki/GCCStatus

Boris



More information about the odb-users mailing list