[odb-users] Sharing common object between multiple ODB schemas
Boris Kolpackov
boris at codesynthesis.com
Tue Oct 15 10:16:01 EDT 2019
Per Edin <per.edin at sequence-point.se> writes:
> odb ... --at-once --schema-name core core/core.hxx
> odb ... --at-once --schema-name extras extras/extras.hxx
>
> core/core.hxx and extras/extras.hxx includes all headers belonging to
> the respective schemas.
>
> As can be seen the uuid class is shared between the two schemas. Can
> you recommend a way to handle this? Currently, the database code for
> class my_app::uuid ends up in both core-odb._xx and profile-odb._xx
> resulting in duplicate symbols.
The only way is not to use the --at-once mode for the C++ code
generation. This way you would compile uuid.hxx separately with
core and extras' *-odb files including uuid-odb.hxx.
> I guess I could just copy uuid.hxx to both core/ and extras/ but that
> doesn't feel right.
That's the only way to make it work in the --at-once mode (you could
avoid physical copy by including the header inside a namespace).
More information about the odb-users
mailing list