0
私はPythonにバインドしたいC++ライブラリを持っています。私はPybindgenを使い始めました。本当に使いやすいですが、関数や名前空間を手動で追加するには、C++ライブラリのサイズを考慮すると時間がかかります。私は、PyBindGenのドキュメント、特に私のためにヘッダファイルをスキャンするgccxmlの部分を読みました。これは理想的ですが、私はそれが適切に機能するようにすることはできません。ただ、テストとして、私は私のメインのヘッダファイルを入力し、それをエクスポートしようとしたが、私はこのエラーを取得する:pybindgenでgccxmlを使用できない
python bindinggenerator.py
Traceback (most recent call last):
File "bindinggenerator.py", line 16, in <module>
main()
File "bindinggenerator.py", line 9, in main
module = module_parser.parse("include\\PhospheneEngine.h")
File "C:\Users\paolo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pybindgen\gccxmlparser.py", line 598, in parse
pygen_classifier, gccxml_options)
File "C:\Users\paolo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pybindgen\gccxmlparser.py", line 658, in parse_init
assert isinstance(header_files, list)
AssertionError
そしてもちろん、私のPythonコードは、基本的にhereからわずか変形例です。
import sys
import pybindgen
from pybindgen import FileCodeSink
from pybindgen.gccxmlparser import ModuleParser
def main():
module_parser = ModuleParser('PhospheneEngine', '::')
module = module_parser.parse("include\\PhospheneEngine.h")
module.add_include("'include\\PhospheneEngine.h'")
pybindgen.write_preamble(FileCodeSink(sys.stdout))
module.generate(FileCodeSink(sys.stdout))
if (__name__ == '__main__'):
main()
gccxmlとpygccxml(Python 3.5用)の両方がインストールされています。ドキュメンテーションは実際にこのプロセスについてあまり話していないので、この機能を使用する方法の素早い説明は高く評価されます。
ありがとうございます。