[odb-users] Multi-Database Support - Cannot integrate Multi-Database Support / Bug report for the compiler: odb-2.2.1-i686-windows

Boris Kolpackov boris at codesynthesis.com
Tue May 28 10:24:16 EDT 2013


Hi Benjamin,

Benjamin Schudel <benjamin.schudel at nexirius.com> writes:

> But I still get the Unhandled exception which occurs on the
> User-odb.ixx-file.
> 
> [...]
> 
> You said I should be careful if User-odb-mssql.cxx is packaged into a
> static library... What do you exactly mean with that?

When using a static library (.lib on Windows and .a on Linux/UNIX), the
linker will only link an object file from this library if it contains
a symbol that is referenced from the executable. If, however, the object
file within a library is not referenced, then it will be ignored. And
that's exactly what can happen in dynamic multi-database support since
you don't reference database-specific symbols from your code. Rather,
you work through the common interface.

On Linux, GNU ld has the --whole-archive option which can be used to
override this behavior. Unfortunately, there is nothing like this in
VC++.


> Because all odb generated files are packaged into a static library in my
> vs-solution. Could that be the reason for the exception?

Yes, I am pretty sure this is the cause of the exception. In your case
the easiest option is probably to add the generated code directly to
the executable rather than packaging it into a static library.


> By the way, the bug I reported in the first mail still occurs:
>
> [...]
> 
> #include "UserGroup-odb-mssql.hxx"#include "User-odb.hxx"

Sorry, I must have missed it. I've uploaded an updated revision of
the 2.2.0 binary that should fix this:

http://www.codesynthesis.com/~boris/tmp/odb/odb-2.2.2-i686-windows.zip

Boris



More information about the odb-users mailing list