1 #include "stdio.h"
 2 
 3 struct var_tab_item
 4 {
 5     const char* name;
 6     const char* desc;
 7     char type;
 8     void* var;
 9 };
10 #define SECTION(name) __attribute__((section(name)))
11 #define EXPORT_VAR(name,desc,type) \
12     const char __var_##name##_name[] = #name;\
13     const char __var_##name##_desc[] = #desc;\
14     const struct var_tab_item __var_##name SECTION("ExVar")=\
15     {\
16         __var_##name##_name,\
17         __var_##name##_desc,\
18         type,\
19         (void*)&name\
20     };
21 #define DEFINE_INT32(name,desc) \
22     long long name=0xabcd;\
23     EXPORT_VAR(name,desc,'i')
24 
25 DEFINE_INT32(test0,a test setting)
26 DEFINE_INT32(test1,cool tpdt)
27 
28 int main()
29 {
30     printf("%lld\n",test0);
31     return 0;
32 }