rttr
rttr copied to clipboard
RTTR_REGISTRATION is broken for well separated code
I have two separate files in static library (any kind of project will do). Let's call the files a.cpp
with class A
and b.cpp
with class B
. Each has one occurrence of RTTR_REGISTRATION
.
Code in main.cpp
does not depend on B
directly in any way except rttr::type<B>::get()
call. Since there are no hard dependencies, linker is throwing b.obj
away from linking. All static objects from b.cpp
file are gone and RTTR_REGISTRATION
is never called.
For a moment I assumed rttr
dealt with this problem in a way I'm now aware of yet. As it turns out this is yet to be solved.
Because of this linker behavior engines tends to have one huge file referencing known types or dummy function from files containing them. It does not even have to be called as long as linker sees reference.
Do you by any chance have solution to this problem?
As it turns out #208 speak of same issue.
I just wanted to say that this is an issue in our project, and we are doing some variant of this to prevent things that we need from being linker'd away:
dummy function from files containing them. It does not even have to be called as long as linker sees reference.