import.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Module definition and import interface */
  2. #ifndef Py_IMPORT_H
  3. #define Py_IMPORT_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
  8. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
  9. PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
  10. char *name, PyObject *co, char *pathname);
  11. PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
  12. PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
  13. PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
  14. PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *);
  15. PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
  16. PyObject *globals, PyObject *locals, PyObject *fromlist, int level);
  17. #define PyImport_ImportModuleEx(n, g, l, f) \
  18. PyImport_ImportModuleLevel(n, g, l, f, -1)
  19. PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
  20. PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
  21. PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
  22. PyAPI_FUNC(void) PyImport_Cleanup(void);
  23. PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
  24. #ifdef WITH_THREAD
  25. PyAPI_FUNC(void) _PyImport_AcquireLock(void);
  26. PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
  27. #else
  28. #define _PyImport_AcquireLock()
  29. #define _PyImport_ReleaseLock() 1
  30. #endif
  31. PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
  32. const char *, PyObject *, char *, size_t, FILE **, PyObject **);
  33. PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
  34. PyAPI_FUNC(void) _PyImport_ReInitLock(void);
  35. PyAPI_FUNC(PyObject *) _PyImport_FindExtension(char *, char *);
  36. PyAPI_FUNC(PyObject *) _PyImport_FixupExtension(char *, char *);
  37. struct _inittab {
  38. char *name;
  39. void (*initfunc)(void);
  40. };
  41. PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
  42. PyAPI_DATA(struct _inittab *) PyImport_Inittab;
  43. PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void));
  44. PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
  45. struct _frozen {
  46. char *name;
  47. unsigned char *code;
  48. int size;
  49. };
  50. /* Embedding apps may change this pointer to point to their favorite
  51. collection of frozen modules: */
  52. PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif /* !Py_IMPORT_H */