English content is generated by GPT4.
First and foremost, it is important to note that this is a runtime reflection system. During certain operations, type erasure is performed to meet the requirements of the runtime interface. You can use any type at runtime (including instantiated templates), as long as they are properly registered in the reflection system.
Additionally, the type erasure system is not yet complete and may have issues.
Currently, manual type registration is not supported. All registration code is automatically generated at compile-time based on reflection markers.
You can now use REFLECT_REGISTER_RTTI_TYPE_MANUAL
macro to register type into RTTI system in any scanned header.
Calling zeno_declare_reflection_support
will automatically create a target for reflection generation, and your target will depend on this new target. This means that reflection information is guaranteed to be generated before your target is compiled. Do not assume static reflection information exists in any other targets where reflection is not enabled. Of course, it is safe to use the runtime API anywhere (except during static initialization, as it is good practice not to assume the order of static initialization).
The runtime information registration for the target is achieved by adding a source file generated by the reflection generator, which is currently located at [CMAKE folder]/intermediate/[target name]/[target name].generated.cpp
.
The required static information is generated in the crates/libgenerated/include/reflect
folder. If you need static reflection information, you should include #include "reflect/reflection.generated.hpp"
in your code. When you enable reflection for your target, libgenerated
will be added as an interface
type dependency for your target.
Q: What are the limitations? A: There cannot be types with the same name having reflection markers at the same time, and header file names should not be duplicated.