pylifecycle.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Interfaces to configure, query, create & destroy the Python runtime */
  2. #ifndef Py_PYLIFECYCLE_H
  3. #define Py_PYLIFECYCLE_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /* Initialization and finalization */
  8. PyAPI_FUNC(void) Py_Initialize(void);
  9. PyAPI_FUNC(void) Py_InitializeEx(int);
  10. PyAPI_FUNC(void) Py_Finalize(void);
  11. #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
  12. PyAPI_FUNC(int) Py_FinalizeEx(void);
  13. #endif
  14. PyAPI_FUNC(int) Py_IsInitialized(void);
  15. /* Subinterpreter support */
  16. PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
  17. PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
  18. /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
  19. * exit functions.
  20. */
  21. PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
  22. PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int);
  23. /* Bootstrap __main__ (defined in Modules/main.c) */
  24. PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
  25. PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv);
  26. /* In pathconfig.c */
  27. PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
  28. PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
  29. PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
  30. PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
  31. PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
  32. PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
  33. PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
  34. PyAPI_FUNC(wchar_t *) Py_GetPath(void);
  35. PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
  36. #ifdef MS_WINDOWS
  37. int _Py_CheckPython3(void);
  38. #endif
  39. /* In their own files */
  40. PyAPI_FUNC(const char *) Py_GetVersion(void);
  41. PyAPI_FUNC(const char *) Py_GetPlatform(void);
  42. PyAPI_FUNC(const char *) Py_GetCopyright(void);
  43. PyAPI_FUNC(const char *) Py_GetCompiler(void);
  44. PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
  45. /* Signals */
  46. typedef void (*PyOS_sighandler_t)(int);
  47. PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
  48. PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
  49. #ifndef Py_LIMITED_API
  50. # define Py_CPYTHON_PYLIFECYCLE_H
  51. # include "cpython/pylifecycle.h"
  52. # undef Py_CPYTHON_PYLIFECYCLE_H
  53. #endif
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif /* !Py_PYLIFECYCLE_H */