Get list of C structure members

前端 未结 6 1791
盖世英雄少女心
盖世英雄少女心 2020-12-09 18:07

Is it possible to get the list of members of a structure as a char ** ?

For example, something like this:

struct mystruct {
    int x;
          


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 18:57

    There's no portable standard way of doing this. Last time I wanted to solve a similar problem I used SWIG to produce some XML which I then processed to generate the meta information I wanted. gcc-xml could do the same thing too.

提交回复
热议问题