blob: 1df114a73de3b4466ed5a25d406d72b3e7588004 [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);
Arthur Neufeld3e8f9622018-12-20 15:11:03 -060015#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
Martin Panterb4ce1fc2015-11-30 03:18:29 +000016PyAPI_FUNC(int) Py_FinalizeEx(void);
Arthur Neufeld3e8f9622018-12-20 15:11:03 -060017#endif
Nick Coghland6009512014-11-20 21:39:37 +100018PyAPI_FUNC(int) Py_IsInitialized(void);
Eric Snow1abcf672017-05-23 21:46:51 -070019
20/* Subinterpreter support */
Nick Coghland6009512014-11-20 21:39:37 +100021PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
22PyAPI_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 Coghland6009512014-11-20 21:39:37 +100028PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
29
Victor Stinnercfc88312018-08-01 16:41:25 +020030PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int);
Nick Coghland6009512014-11-20 21:39:37 +100031
Nick Coghland6009512014-11-20 21:39:37 +100032/* Bootstrap __main__ (defined in Modules/main.c) */
33PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
34
Steve Dower177a41a2018-11-17 20:41:48 -080035/* In pathconfig.c */
36PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
37PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
38
39PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
40PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
41
Nick Coghland6009512014-11-20 21:39:37 +100042PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
Steve Dower177a41a2018-11-17 20:41:48 -080043
Nick Coghland6009512014-11-20 21:39:37 +100044PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
45PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
46PyAPI_FUNC(wchar_t *) Py_GetPath(void);
47PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
48#ifdef MS_WINDOWS
Victor Stinner31a83932017-12-04 13:39:15 +010049int _Py_CheckPython3(void);
Nick Coghland6009512014-11-20 21:39:37 +100050#endif
51
52/* In their own files */
53PyAPI_FUNC(const char *) Py_GetVersion(void);
54PyAPI_FUNC(const char *) Py_GetPlatform(void);
55PyAPI_FUNC(const char *) Py_GetCopyright(void);
56PyAPI_FUNC(const char *) Py_GetCompiler(void);
57PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
Nick Coghland6009512014-11-20 21:39:37 +100058
59/* Signals */
60typedef void (*PyOS_sighandler_t)(int);
61PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
62PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
63
Serhiy Storchaka9fab79b2016-09-11 11:03:14 +030064#ifndef Py_LIMITED_API
Victor Stinnerdd12aa02018-11-27 00:12:05 +010065# define Py_CPYTHON_PYLIFECYCLE_H
66# include "cpython/pylifecycle.h"
67# undef Py_CPYTHON_PYLIFECYCLE_H
Erik Bray031c4bf2017-10-27 11:46:03 +020068#endif
69
Nick Coghland6009512014-11-20 21:39:37 +100070#ifdef __cplusplus
71}
72#endif
73#endif /* !Py_PYLIFECYCLE_H */