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