SIGN IN SIGN UP

Protocol Buffers - Google's data interchange format

0 0 2 C++

Define a generated registry for tracking linked-in extensions.

#test-continuous

This behaves similarly to the generated extension registry in other languages.  A global ref-counted (lock-free thread-safe) singleton registry can be lazily constructed from the linker array data produced by gencode.  For now, this is simply used to preserve custom options on the descriptors in our DefPool.

This design makes heavy use of various non-standard C extensions.  It expands on the pre-existing linker arrays used for extensions, adding weak constructors to register all of the extensions linked into each binary.  This was tested and works with clang and gcc, and a similar approach was implemented for MSVC.  For unsupported compilers or architectures, the generated registry will be unpopulated.

PiperOrigin-RevId: 829698259
M
Mike Kruskal committed
a531523b86f166130d823cf1d4040771d3c75d75
Parent: 3159b1b
Committed by Copybara-Service <copybara-worker@google.com> on 11/8/2025, 5:45:59 AM