How to parse a C header file?

后端 未结 4 587
说谎
说谎 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:43

    For the same purpose I'm considering pyclibrary, it is not a complete C parser but it is aimed at parsing C header files, so it is much easier to use than pycparser or some gccxml-based parser: although weakly documented, just try CParser.py testHeader.h and you'll see how it works.

    Depends on pyparsing and, as far as I understand, it is pure python.

提交回复
热议问题