blob: 5419bc943240372090c583e7e08fff61046ff0d9 [file] [log] [blame]
Nick Coghland6009512014-11-20 21:39:37 +10001
2/* Interfaces to configure, query, create & destroy the Python runtime */
3
4#ifndef Py_PYLIFECYCLE_H
5#define Py_PYLIFECYCLE_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
Nick Coghland6009512014-11-20 21:39:37 +100010
Eric Snow1abcf672017-05-23 21:46:51 -070011/* Initialization and finalization */
Nick Coghland6009512014-11-20 21:39:37 +100012PyAPI_FUNC(void) Py_Initialize(void);
13PyAPI_FUNC(void) Py_InitializeEx(int);
Nick Coghland6009512014-11-20 21:39:37 +100014PyAPI_FUNC(void) Py_Finalize(void);
Martin Panterb4ce1fc2015-11-30 03:18:29 +000015PyAPI_FUNC(int) Py_FinalizeEx(void);
Nick Coghland6009512014-11-20 21:39:37 +100016PyAPI_FUNC(int) Py_IsInitialized(void);
Eric Snow1abcf672017-05-23 21:46:51 -070017
18/* Subinterpreter support */
Nick Coghland6009512014-11-20 21:39:37 +100019PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
20PyAPI_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 Coghland6009512014-11-20 21:39:37 +100026PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
27
Victor Stinnercfc88312018-08-01 16:41:25 +020028PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int);
Nick Coghland6009512014-11-20 21:39:37 +100029
Nick Coghland6009512014-11-20 21:39:37 +100030/* Bootstrap __main__ (defined in Modules/main.c) */
31PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
32
Steve Dower177a41a2018-11-17 20:41:48 -080033/* In pathconfig.c */
34PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
35PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
36
37PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
38PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
39
Nick Coghland6009512014-11-20 21:39:37 +100040PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
Steve Dower177a41a2018-11-17 20:41:48 -080041
Nick Coghland6009512014-11-20 21:39:37 +100042PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
43PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
44PyAPI_FUNC(wchar_t *) Py_GetPath(void);
45PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
46#ifdef MS_WINDOWS
Victor Stinner31a83932017-12-04 13:39:15 +010047int _Py_CheckPython3(void);
Nick Coghland6009512014-11-20 21:39:37 +100048#endif
49
50/* In their own files */
51PyAPI_FUNC(const char *) Py_GetVersion(void);
52PyAPI_FUNC(const char *) Py_GetPlatform(void);
53PyAPI_FUNC(const char *) Py_GetCopyright(void);
54PyAPI_FUNC(const char *) Py_GetCompiler(void);
55PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
Nick Coghland6009512014-11-20 21:39:37 +100056
57/* Signals */
58typedef void (*PyOS_sighandler_t)(int);
59PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
60PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
61
Serhiy Storchaka9fab79b2016-09-11 11:03:14 +030062#ifndef Py_LIMITED_API
Victor Stinnerdd12aa02018-11-27 00:12:05 +010063# define Py_CPYTHON_PYLIFECYCLE_H
64# include "cpython/pylifecycle.h"
65# undef Py_CPYTHON_PYLIFECYCLE_H
Erik Bray031c4bf2017-10-27 11:46:03 +020066#endif
67
Nick Coghland6009512014-11-20 21:39:37 +100068#ifdef __cplusplus
69}
70#endif
71#endif /* !Py_PYLIFECYCLE_H */