I've searched all over the web and can't seem to find documentation or even a simple explanation of what PyAPI_DATA() does (even though it is used in the Python header files and cited on python.o开发者_如何学运维rg). Could anyone care to explain what this is or point me to documentation I am overlooking?
Thanks.
It's used to mark public API variables (as Python's core is usually a dynamic library), e.g. on Windows, it's expanded to extern __declspec(dllexport) RTYPE
when core is compiled and to extern __declspec(dllimport) RTYPE
when e.g. modules are compiled. It's defined in Include/pyport.h
.
精彩评论