pyd
- c使用swig、cpython
- c++使用boost.python、pybind11(pip install pybind11)
pyd生成依赖python.h文件,里面包含pyconfig.h,最终生成的dll会产生对python(version).dll,而同时导入多个python.dll会导致python提示冲突
定义Py_LIMITED_API宏,使用python3.lib,python3.0以上版本通用,不过只适用于cpython,c的调用方式
ctypes
- CDLL(“dll_name.dll”,winmode=0)加载dll,还有WINDLL、PYDLL
- structure结构体封装
class T(structure):