Open thedmd opened 4 years ago
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.
I have two separate files in static library (any kind of project will do). Let's call the files
a.cpp
with classA
andb.cpp
with classB
. Each has one occurrence ofRTTR_REGISTRATION
. Code inmain.cpp
does not depend onB
directly in any way exceptrttr::type<B>::get()
call. Since there are no hard dependencies, linker is throwingb.obj
away from linking. All static objects fromb.cpp
file are gone andRTTR_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?