Files
cchax/mod.h
2025-09-15 16:08:41 +02:00

24 lines
838 B
C

#ifndef CCHAX_MOD_H
#define CCHAX_MOD_H
typedef int (*fn_t)(void);
typedef struct mod_t {
char const* name;
fn_t fn;
} mod_t;
#define mod_register(name_ref, fn_ref) \
static struct mod_t mod_##name_ref __attribute__(( \
used, \
section("__mod_list"), \
aligned(__alignof__(struct mod_t)) \
)) = { \
.name = #name_ref, \
.fn = fn_ref \
}
void run_mods(void);
#endif // !CCHAX_MOD_H