Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 1 | |
| 2 | /* Interfaces to configure, query, create & destroy the Python runtime */ |
| 3 | |
| 4 | #ifndef Py_PYLIFECYCLE_H |
| 5 | #define Py_PYLIFECYCLE_H |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 10 | |
Eric Snow | 1abcf67 | 2017-05-23 21:46:51 -0700 | [diff] [blame] | 11 | /* Initialization and finalization */ |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 12 | PyAPI_FUNC(void) Py_Initialize(void); |
| 13 | PyAPI_FUNC(void) Py_InitializeEx(int); |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 14 | PyAPI_FUNC(void) Py_Finalize(void); |
Arthur Neufeld | 3e8f962 | 2018-12-20 15:11:03 -0600 | [diff] [blame] | 15 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 |
Martin Panter | b4ce1fc | 2015-11-30 03:18:29 +0000 | [diff] [blame] | 16 | PyAPI_FUNC(int) Py_FinalizeEx(void); |
Arthur Neufeld | 3e8f962 | 2018-12-20 15:11:03 -0600 | [diff] [blame] | 17 | #endif |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 18 | PyAPI_FUNC(int) Py_IsInitialized(void); |
Eric Snow | 1abcf67 | 2017-05-23 21:46:51 -0700 | [diff] [blame] | 19 | |
| 20 | /* Subinterpreter support */ |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 21 | PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); |
| 22 | PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); |
| 23 | |
| 24 | |
| 25 | /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level |
| 26 | * exit functions. |
| 27 | */ |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 28 | PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); |
| 29 | |
Victor Stinner | cfc8831 | 2018-08-01 16:41:25 +0200 | [diff] [blame] | 30 | PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int); |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 31 | |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 32 | /* Bootstrap __main__ (defined in Modules/main.c) */ |
| 33 | PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv); |
| 34 | |
Miss Islington (bot) | 1d4285a | 2019-08-26 16:17:56 -0700 | [diff] [blame] | 35 | PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv); |
| 36 | |
Steve Dower | 177a41a | 2018-11-17 20:41:48 -0800 | [diff] [blame] | 37 | /* In pathconfig.c */ |
| 38 | PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *); |
| 39 | PyAPI_FUNC(wchar_t *) Py_GetProgramName(void); |
| 40 | |
| 41 | PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *); |
| 42 | PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void); |
| 43 | |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 44 | PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void); |
Steve Dower | 177a41a | 2018-11-17 20:41:48 -0800 | [diff] [blame] | 45 | |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 46 | PyAPI_FUNC(wchar_t *) Py_GetPrefix(void); |
| 47 | PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void); |
| 48 | PyAPI_FUNC(wchar_t *) Py_GetPath(void); |
| 49 | PyAPI_FUNC(void) Py_SetPath(const wchar_t *); |
| 50 | #ifdef MS_WINDOWS |
Victor Stinner | 31a8393 | 2017-12-04 13:39:15 +0100 | [diff] [blame] | 51 | int _Py_CheckPython3(void); |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 52 | #endif |
| 53 | |
| 54 | /* In their own files */ |
| 55 | PyAPI_FUNC(const char *) Py_GetVersion(void); |
| 56 | PyAPI_FUNC(const char *) Py_GetPlatform(void); |
| 57 | PyAPI_FUNC(const char *) Py_GetCopyright(void); |
| 58 | PyAPI_FUNC(const char *) Py_GetCompiler(void); |
| 59 | PyAPI_FUNC(const char *) Py_GetBuildInfo(void); |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 60 | |
| 61 | /* Signals */ |
| 62 | typedef void (*PyOS_sighandler_t)(int); |
| 63 | PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); |
| 64 | PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); |
| 65 | |
Serhiy Storchaka | 9fab79b | 2016-09-11 11:03:14 +0300 | [diff] [blame] | 66 | #ifndef Py_LIMITED_API |
Victor Stinner | dd12aa0 | 2018-11-27 00:12:05 +0100 | [diff] [blame] | 67 | # define Py_CPYTHON_PYLIFECYCLE_H |
| 68 | # include "cpython/pylifecycle.h" |
| 69 | # undef Py_CPYTHON_PYLIFECYCLE_H |
Erik Bray | 031c4bf | 2017-10-27 11:46:03 +0200 | [diff] [blame] | 70 | #endif |
| 71 | |
Nick Coghlan | d600951 | 2014-11-20 21:39:37 +1000 | [diff] [blame] | 72 | #ifdef __cplusplus |
| 73 | } |
| 74 | #endif |
| 75 | #endif /* !Py_PYLIFECYCLE_H */ |