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

Benjamin Schudel benjamin.schudel at nexirius.com
Wed May 29 09:58:49 EDT 2013


Hi Boris,

The multi database support seems to work now.
It was the static library issue, as you said.
I could fix the problem with two changes on the Linker-Settings of the
executable project.
I found out when you set the property "Use Library Dependency Inputs" to
"true" and "References" to "No (/OPT:NOREF)", you can keep the odb-files
into the static library package.

Thank you for the help,
regards Benjamin


-----Ursprüngliche Nachricht-----
Von: Boris Kolpackov [mailto:boris at codesynthesis.com]
Gesendet: Dienstag, 28. Mai 2013 16:24
An: Benjamin Schudel
Cc: odb-users at codesynthesis.com
Betreff: Re: [odb-users] Multi-Database Support - Cannot integrate
Multi-Database Support / Bug report for the compiler:
odb-2.2.1-i686-windows

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