How to parse a C header file?

后端 未结 4 593
说谎
说谎 2020-12-08 00:59

Does anyone know a spiffy way to use C header files in Python? For example I have a C program that includes a global variable:

typedef struct ImageInfo
{
            


        
4条回答
  •  一向
    一向 (楼主)
    2020-12-08 01:53

    This was mentioned on SO yesterday; I haven't had a chance to check it out more thoroughly yet, but I'm meaning to. The pycparser, a "C parser and AST generator written in Python".

    https://github.com/eliben/pycparser

提交回复
热议问题