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
Then within various object files, I include rttr/registration and have RTTR_REGISTRATION { ... };. In other words libraryB/somestructinb.cpp has a single RTTR_REGISTRATION ..., another file libraryB/anotherstructinb.cpp has another RTTR_REGISTRATION for its structs/classes, and so forth. The same applies to library A. For the above example, its cpp file would look like this:
#include "somestructinb.h"
namespace library_b {
RTTR_REGISTRATION {
rttr::registration::Class_<SomeStructInB>("some-struct-in-b")
.constructor<>(); // and so forth.
};
};
In Library A, I have implemented a serialization routine for RTTR types so that I can deal with serializing and deserializing both library A's and library B's types.
At runtime, I get an access violation on the aforementioned get_base_types() call, and I'm not sure why. The stack trace's last line of my code is in the Library A's RTTR_REGISTRATION. The documentation seems to be suggesting this design is possible, that a given object file may have exactly one RTTR_REGISTRATION call, which is what I've implemented. Quoting the docs found here:
It is not possible to place the macro multiple times in one cpp file.
Therefore, it is possible to place the macro multiple times as long as it's only once per cpp file.
In a completely different project, I have rttr working fine, but in the whole of all of its dependencies, that project has exactly one instance of RTTR_REGISTRATION throughout the entire codebase.
I'm not sure where to look for why this access violation is occurring. Can someone please point me in the right direction?
The text was updated successfully, but these errors were encountered:
I'm using the RTTR commit
7edbd58
as my reference on Windows, using MSVC's cl as my compiler (2022).I have a pair of libraries, let's call them library A and B. A depends on B. Both A and B have headers with publicly visible C++ structs like this:
Then within various object files, I include
rttr/registration
and haveRTTR_REGISTRATION { ... };
. In other wordslibraryB/somestructinb.cpp
has a singleRTTR_REGISTRATION ...
, another filelibraryB/anotherstructinb.cpp
has anotherRTTR_REGISTRATION
for its structs/classes, and so forth. The same applies to library A. For the above example, its cpp file would look like this:In Library A, I have implemented a serialization routine for RTTR types so that I can deal with serializing and deserializing both library A's and library B's types.
At runtime, I get an access violation on the aforementioned
get_base_types()
call, and I'm not sure why. The stack trace's last line of my code is in the Library A'sRTTR_REGISTRATION
. The documentation seems to be suggesting this design is possible, that a given object file may have exactly oneRTTR_REGISTRATION
call, which is what I've implemented. Quoting the docs found here:Therefore, it is possible to place the macro multiple times as long as it's only once per cpp file.
In a completely different project, I have
rttr
working fine, but in the whole of all of its dependencies, that project has exactly one instance ofRTTR_REGISTRATION
throughout the entire codebase.I'm not sure where to look for why this access violation is occurring. Can someone please point me in the right direction?
The text was updated successfully, but these errors were encountered: