g3c*_*cko 5 python windows python-2.7 libclang
我正在尝试探索libclang(在Windows上)以基于AST分析“ stuff *”。我发现了几个例子,但我什么都做不了。
当我尝试运行此
index = clang.cindex.Index.create()
tu = index.parse(sys.argv[1], args=['-x', 'c++'])
print len(tu.cursor.get_children())
Run Code Online (Sandbox Code Playgroud)
我遇到访问冲突,
File "C:\python27\lib\site-packages\clang\cindex.py", line 1783, in get_children
children)
WindowsError: exception: access violation writing 0x000000001D1B81A8
cindex.py在这里稍有不同(https://github.com/llvm-mirror/clang/tree/master/bindings/python),但给出的结果相同,只是一行不同。
此外,似乎有些杰出的错误(https://bugs.llvm.org/show_bug.cgi?id=13907)听起来非常相似...尽管现在已经有好几年了。
这样,当前在Windows上有人使用吗? 看来这可能在某个时候起作用了...
似乎libclang是推荐的方法,而python易于使用,但似乎不起作用。
*注意:按东西,我想使用属性来生成序列化函数或绑定,以标记类/结构。
LLVM 7.0(和6.0)
Windows 10
python 2.7 x64