blob: c5368b3c5edaa08c7db2ca2f30d291127e1839d8 [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
Miss Islington (bot)1d4285a2019-08-26 16:17:56 -070035PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv);
36
Steve Dower177a41a2018-11-17 20:41:48 -080037/* In pathconfig.c */
38PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
39PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
40
41PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
42PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
43
Nick Coghland6009512014-11-20 21:39:37 +100044PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
Steve Dower177a41a2018-11-17 20:41:48 -080045
Nick Coghland6009512014-11-20 21:39:37 +100046PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
47PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
48PyAPI_FUNC(wchar_t *) Py_GetPath(void);
49PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
50#ifdef MS_WINDOWS
Victor Stinner31a83932017-12-04 13:39:15 +010051int _Py_CheckPython3(void);
Nick Coghland6009512014-11-20 21:39:37 +100052#endif
53
54/* In their own files */
55PyAPI_FUNC(const char *) Py_GetVersion(void);
56PyAPI_FUNC(const char *) Py_GetPlatform(void);
57PyAPI_FUNC(const char *) Py_GetCopyright(void);
58PyAPI_FUNC(const char *) Py_GetCompiler(void);
59PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
Nick Coghland6009512014-11-20 21:39:37 +100060
61/* Signals */
62typedef void (*PyOS_sighandler_t)(int);
63PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
64PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
65
Serhiy Storchaka9fab79b2016-09-11 11:03:14 +030066#ifndef Py_LIMITED_API
Victor Stinnerdd12aa02018-11-27 00:12:05 +010067# define Py_CPYTHON_PYLIFECYCLE_H
68# include "cpython/pylifecycle.h"
69# undef Py_CPYTHON_PYLIFECYCLE_H
Erik Bray031c4bf2017-10-27 11:46:03 +020070#endif
71
Nick Coghland6009512014-11-20 21:39:37 +100072#ifdef __cplusplus
73}
74#endif
75#endif /* !Py_PYLIFECYCLE_H */