Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在网上搜索过,似乎找不到文档,甚至找不到 PyAPI_DATA() 作用的简单解释(即使它在 Python 头文件中使用并在 python.org 上引用)。任何人都可以解释这是什么或指向我忽略的文档吗?
谢谢。
它用于标记公共 API 变量(因为 Python 的核心通常是一个动态库),例如在 Windows 上,它被扩展到extern __declspec(dllexport) RTYPE何时编译核心以及extern __declspec(dllimport) RTYPE何时编译模块。它定义在Include/pyport.h.
extern __declspec(dllexport) RTYPE
extern __declspec(dllimport) RTYPE
Include/pyport.h