syms.h 658 B

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