Discussion:
[odb-users] How to separate code in several dynamic libraries
francois cellier
2018-05-23 16:16:14 UTC
Permalink
Hello,

On my project, I need to have binary code separated in several dynamic libraries regarding some criterion.
In each library I have classes with specific odb pragma annotations. However there are some dependancies between the libraries. For example let's say that libA depends on libB.

I succeeded into generating the schema for my complete model (libA and libB) in one sql file and that is fine.
I also succeeded to generate the *.ixx, *.hxx and *.cxx files for the libB as it has no dependencies on external (to libB) classes that have odb pragma annotations.

However I have trouble to generate the *.ixx, *.hxx and *.cxx files of the libA. I always have in the generated code of the libB classes and I would like to have only the code of the libA classes.
The solution proposed here : https://www.codesynthesis.com/pipermail/odb-users/2015-October/002911.html does not seem to work for me.
Even if I do not set the "definition" annotation, the code for the classes in libB is generated.

Do you have any idea of how it should be done ?

Thanks for your help,
François



 
Boris Kolpackov
2018-05-24 16:27:24 UTC
Permalink
Post by francois cellier
Do you have any idea of how it should be done ?
Show how (i.e., the ODB compiler command line) you generate the *-odb.*
files for each library.
francois cellier
2018-05-28 09:45:33 UTC
Permalink
Hi Boris,

Thank you for your answer. To answer your question I used the following options on odb : -d ; --at-once; --default-pointer and --std

However I may have solved my problem this morning in the folowing way:- creating two libs with C++ classes and odb annotation called libModelA and libModelB (libModelA has dependency on some classes of libModelB). In those libraries no code has been generated by odb.
- creating a library libOdbB which contains the generated code by odb and some other stuff (the odb software is applied on the annotated C++ files of libModelB)
- creating a library libOdbA which contains the generated code by odb for the libModelA and only the required dependancies (i.e. a subset of libModelB).

By doing this I have some code duplication in the generated files by odb (on the subset of classes of libModelB used by libModelA) but as it is automatically generated code, it is fine with me...
Post by francois cellier
Do you have any idea of how it should be done ?
Show how (i.e., the ODB compiler command line) you generate the *-odb.*
files for each library.

Loading...