syms.h 692 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. namespace NPrivate {
  3. struct ICB {
  4. virtual void Apply(const char* mod, const char* name, void* sym) = 0;
  5. virtual ~ICB() = default;
  6. };
  7. void ForEachSymbol(ICB& cb);
  8. void RegisterSymbol(const char* mod, const char* name, void* sym);
  9. }
  10. #define BEGIN_SYMS(name) \
  11. namespace { \
  12. static struct TRegister { \
  13. const char* ModuleName = name; \
  14. inline TRegister() {
  15. #define END_SYMS() \
  16. } \
  17. } \
  18. REGISTRY; \
  19. }
  20. #define SYM_2(n, s) ::NPrivate::RegisterSymbol(this->ModuleName, n, (void*)&s);
  21. #define SYM(s) SYM_2(#s, s);