CallMeMaybe: Building Modern Runtime Reflection via C++26
Laurie Kirk
Upcoming native static reflection in C++26 opens the door to new dynamic reflection capabilities. Prior to built-in class introspection, runtime reflection libraries required manual, annotated class metadata. What if we built off new static reflection capabilities to create a runtime registry that is both automated and type-safe?
C++ has avoided the massive overhead seen in languages with fully-native runtime reflection. In most native implementations, such as Java, every class must store runtime metadata regardless of whether it will actually be reflected. In this talk, I will discuss how to harness compile-time std::meta functions to create a runtime reflection registry only for classes requiring reflection. This newly available technique eliminates the brittle, manual macro registration used by RTTR or the external requirements of the Qt moc model.
Bloated binary size and added runtime overhead remain the constant pitfalls of runtime reflection. To combat these, I will also introduce signature-based deduplication, benchmarks of various invocation strategies, and symbol stripping via granular reflection control. On top of that, simulating a runtime "reflectable" profile with attributes and concepts ensures classes attempting to register meet safe reflection requirements.
This talk will introduce a brand new, open-source runtime reflection library for C++ based on the most recent language additions. It will also cover a great deal of hands-on C++26 static reflection usage (currently experimental).
Laurie Kirk
Laurie Kirk is a researcher at Google specializing in low-level programming, reverse engineering, and deobfuscation. She runs a YouTube channel (@LaurieWired) that covers all sorts of in-depth research topics on reverse engineering, programming, and software optimizations. She has spoken at multiple conferences including Strange Loop, DEFCON, REcon, Objective by the Sea, and TROOPERS.