aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/symbols/registry/syms.h
blob: 53d684f5d9ba9df112be1d2ccdff74f52efa175a (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
25
#pragma once

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

    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);