共有 0 个贴子
没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > reflecxx |
reflecxx
|
0 | 0 | 23 |
贡献者 | 讨论 | 代码提交 |
Reflecxx is a simple tool for generating type information for C/C++ code. It works by translating debugging information in object files into C data structures that can be linked into your program. Type information is only generated when it is referenced in your source code, so extraneous data will not be included. For example, if you wanted to convert an enumerated value to a string, you would declare the type and an external reference to the type information to be generated:
enum hw_enum_t { HELLO_WORLD };
extern struct reflecxx_full_type hw_enum_t_type_info;Then, to convert the value, you would use the reflecxx_enum_by_value() function:
printf('%s\n', reflecxx_enum_by_value(&hw_enum_t_type_info, HELLO_WORLD)->
ree_name);To generate the type information, first, you would compile the file and then run reflecxx-gen:
$ gcc hw.c -c -o hw.o
$ reflecxx-gen hw.o > hw-type-info.c
$ gcc hw-type-info.c hw.o -o hw
$ ./hw
HELLO_WORLDFeaturesJSON compatibility for writing out and reading in values. C/Invoke compatibility for functions.