hollyhock
Loading...
Searching...
No Matches
appdef.h
1#pragma once
2
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#include <stdint.h>
8
9#define HOLLYHOCK_ELF_NOTE(type, str) \
10 __attribute__ ((section(".note.hollyhock"), used, aligned(4))) \
11 static const struct { \
12 uint32_t namesz; \
13 uint32_t descsz; \
14 uint32_t _type; \
15 char name[sizeof(#type) + (4 - sizeof(#type) % 4) % 4]; \
16 char desc[sizeof(str) + (4 - sizeof(str) % 4) % 4]; \
17 } hollyhock_elf_note##type = { \
18 sizeof(#type), \
19 sizeof(str), \
20 1, \
21 #type, \
22 str, \
23 };
24
25#define APP_NAME(app_name) \
26 HOLLYHOCK_ELF_NOTE(NAME, app_name)
27#define APP_DESCRIPTION(app_description) \
28 HOLLYHOCK_ELF_NOTE(DESCRIPTION, app_description)
29#define APP_AUTHOR(app_author) \
30 HOLLYHOCK_ELF_NOTE(AUTHOR, app_author)
31#define APP_VERSION(app_version) \
32 HOLLYHOCK_ELF_NOTE(VERSION, app_version)
33
34#ifdef __cplusplus
35}
36#endif