You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, actually this is not and issue (yet?), just a question.
In the amazing documentation about the concept of extensible classes, we can found the following wording (not cited, just meaning): concrete classes should be put in the common (TR:: in our case) namespace and the file name for the header with the class definition should be after the class' name. Also, we can (and do!) re-declare a concrete class between projects.
For example, omr containas the compiler/codegen/CodeGenerator.hpp header and the TR::CodeGenerator class is defined there. Also, openj9 contains the same header where the same class in defined. Unfortunately, I wasn't able to find an example of not header-only concrete class what would be re-declared between the projects, but I believe this example is enough: both CodeGenerator.hpp headers are included in many, many extensible classes in both projects and those classes have a corresponding .cpp implementation part.
So, the question is, whether there is an ODR violation and if so, how the omr and openj9 projects are protected? Because openj9 has omr as a dependency, omr should be built first and will have the compiler library with the corresponding object modules that contain the first definition of the TR::CodeGenerator class. When we build the openj9 project, it gets the its own compiler library, which will contain the second definition of the TR::CodeGenerator class. Then we link both projects and an ODR violation should be there. This is how I get the things.
What protect openj9 from the ODR violation with the upstream project? I believe this is the correct linking ordering for object modules and dependencies, but maybe I'm missing something?
Thank your very much for any help. I think the extensible classes concept is a great invention and would be glad to understand it deeply.
The text was updated successfully, but these errors were encountered:
Hello everyone, actually this is not and issue (yet?), just a question.
In the amazing documentation about the concept of extensible classes, we can found the following wording (not cited, just meaning): concrete classes should be put in the common (
TR::
in our case) namespace and the file name for the header with the class definition should be after the class' name. Also, we can (and do!) re-declare a concrete class between projects.For example,
omr
containas thecompiler/codegen/CodeGenerator.hpp
header and theTR::CodeGenerator
class is defined there. Also,openj9
contains the same header where the same class in defined. Unfortunately, I wasn't able to find an example of not header-only concrete class what would be re-declared between the projects, but I believe this example is enough: bothCodeGenerator.hpp
headers are included in many, many extensible classes in both projects and those classes have a corresponding.cpp
implementation part.So, the question is, whether there is an ODR violation and if so, how the omr and openj9 projects are protected? Because openj9 has omr as a dependency, omr should be built first and will have the compiler library with the corresponding object modules that contain the first definition of the
TR::CodeGenerator
class. When we build the openj9 project, it gets the its own compiler library, which will contain the second definition of theTR::CodeGenerator
class. Then we link both projects and an ODR violation should be there. This is how I get the things.What protect openj9 from the ODR violation with the upstream project? I believe this is the correct linking ordering for object modules and dependencies, but maybe I'm missing something?
Thank your very much for any help. I think the extensible classes concept is a great invention and would be glad to understand it deeply.
The text was updated successfully, but these errors were encountered: