python bindings胶带 c++:将Python与C++联系在一起

Python既然被称为胶水语言,那么一定有它的道理。那么如何编写Python Bindings,让Python代码可以调用C++类库呢?

首先,为什么不直接用Python写呢?因为(1)有些成熟的代码库是用C++写的,重写一遍。。是不是有点太浪费了?(2)Python运行速度不如C++快,就算是现在依然有人选择C++与Python结合的方式来开发,C++实现底层功能,Python实现高层的调度。

那么,如何编写Python bindings(Python胶带)?

参考文献:

Write your own Python bindings:https://www.qt.io/blog/2018/05/31/write-python-bindings

Python Bindings:Integrating Python With Other Languages:https://wiki.python.org/moin/IntegratingPythonWithOtherLanguage

PyBind11:https://github.com/pybind/pybind11

Python Bindings - 从 Python 调用 C/C++:https://zhuanlan.zhihu.com/p/143356193

猜你喜欢

转载自blog.csdn.net/nmj2008/article/details/114143336