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
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/IF4RVTIWNQQE5I3MSVKLZM6LYVLNFGRY/

Reply via email to