[Python-Dev] Re: PyAPI_FUNC() is needed to private APIs?

2019年7月02日 01:54:12 -0700

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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/IF4RVTIWNQQE5I3MSVKLZM6LYVLNFGRY/

Reply via email to