aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/symbols/registry/syms.h
blob: 5e34d35298ced5e4ec0d2dc103c0348274151705 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

namespace NPrivate {
    struct ICB {
        virtual void Apply(const char* mod, const char* name, void* sym) = 0;
    };

    void ForEachSymbol(ICB& cb);
    void RegisterSymbol(const char* mod, const char* name, void* sym);
}

#define BEGIN_SYMS(name)                   \
    namespace {                            \
        static struct TRegister {          \
            const char* ModuleName = name; \
            inline TRegister() {
#define END_SYMS() \
    }              \
    }              \
    REGISTRY;      \
    }

#define SYM_2(n, s) ::NPrivate::RegisterSymbol(this->ModuleName, n, (void*)&s);
#define SYM(s) SYM_2(#s, s);