Le 02/07/2019 à 06:35, Inada Naoki a écrit :
I wanted to discuss about only when PyAPI_FUNC() is needed, not about which function should be public.
On Unix, PyAPI_FUNC() or extern is basically the same currently:
#define PyAPI_FUNC(RTYPE) RTYPE #define PyAPI_DATA(RTYPE) extern RTYPE
On Windows, PyAPI_FUNC() exports the symbol in the Python DLL ("dllexport"), whereas by default symbols are not exported (cannot by used outside Python binary). Without PyAPI_FUNC(), a symbol cannot be used on Windows. Macros when building Python:
#define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE #define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
Macros when using Python headers:
#define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE #define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
Victor