import.h 3.81 KB
Newer Older
1

Guido van Rossum's avatar
Guido van Rossum committed
2 3
/* Module definition and import interface */

4 5 6 7 8 9
#ifndef Py_IMPORT_H
#define Py_IMPORT_H
#ifdef __cplusplus
extern "C" {
#endif

10 11 12
PyAPI_FUNC(void) _PyImportZip_Init(void);

PyMODINIT_FUNC PyInit_imp(void);
13
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
Barry Warsaw's avatar
Barry Warsaw committed
14
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
15
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
16
    const char *name,           /* UTF-8 encoded string */
17 18
    PyObject *co
    );
19
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
20
    const char *name,           /* UTF-8 encoded string */
21
    PyObject *co,
22
    const char *pathname        /* decoded from the filesystem encoding */
23
    );
Barry Warsaw's avatar
Barry Warsaw committed
24
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
25
    const char *name,           /* UTF-8 encoded string */
26
    PyObject *co,
27 28
    const char *pathname,       /* decoded from the filesystem encoding */
    const char *cpathname       /* decoded from the filesystem encoding */
29
    );
30 31 32 33 34 35
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
    PyObject *name,
    PyObject *co,
    PyObject *pathname,
    PyObject *cpathname
    );
36
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
37 38 39
PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
    PyObject *name
    );
40 41 42 43 44 45 46 47 48 49
PyAPI_FUNC(PyObject *) PyImport_AddModule(
    const char *name            /* UTF-8 encoded string */
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
    const char *name            /* UTF-8 encoded string */
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
    const char *name            /* UTF-8 encoded string */
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
50
    const char *name,           /* UTF-8 encoded string */
51
    PyObject *globals,
52 53 54 55 56 57 58
    PyObject *locals,
    PyObject *fromlist,
    int level
    );
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
    PyObject *name,
    PyObject *globals,
59 60 61 62
    PyObject *locals,
    PyObject *fromlist,
    int level
    );
63 64

#define PyImport_ImportModuleEx(n, g, l, f) \
65
    PyImport_ImportModuleLevel(n, g, l, f, 0)
66

67
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
68 69 70
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
PyAPI_FUNC(void) PyImport_Cleanup(void);
71 72 73
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
    PyObject *name
    );
74
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
75
    const char *name            /* UTF-8 encoded string */
76
    );
77

78
#ifndef Py_LIMITED_API
79 80 81 82 83 84 85 86
#ifdef WITH_THREAD
PyAPI_FUNC(void) _PyImport_AcquireLock(void);
PyAPI_FUNC(int) _PyImport_ReleaseLock(void);
#else
#define _PyImport_AcquireLock()
#define _PyImport_ReleaseLock() 1
#endif

87
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
88

89
PyAPI_FUNC(PyObject *)_PyImport_FindBuiltin(
90
    const char *name            /* UTF-8 encoded string */
91
    );
92
PyAPI_FUNC(PyObject *)_PyImport_FindExtensionObject(PyObject *, PyObject *);
93 94
PyAPI_FUNC(int)_PyImport_FixupBuiltin(
    PyObject *mod,
95
    const char *name            /* UTF-8 encoded string */
96
    );
97
PyAPI_FUNC(int)_PyImport_FixupExtensionObject(PyObject*, PyObject *, PyObject *);
98

99
struct _inittab {
100
    const char *name;           /* ASCII encoded string */
101
    PyObject* (*initfunc)(void);
102
};
103 104 105
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
#endif /* Py_LIMITED_API */
106

107
PyAPI_DATA(PyTypeObject) PyNullImporter_Type;
108

109 110 111 112
PyAPI_FUNC(int) PyImport_AppendInittab(
    const char *name,           /* ASCII encoded string */
    PyObject* (*initfunc)(void)
    );
113

114
#ifndef Py_LIMITED_API
115
struct _frozen {
116 117
    const char *name;                 /* ASCII encoded string */
    const unsigned char *code;
118
    int size;
119 120 121 122 123
};

/* Embedding apps may change this pointer to point to their favorite
   collection of frozen modules: */

124
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
125
#endif
126

127 128 129 130
#ifdef __cplusplus
}
#endif
#endif /* !Py_IMPORT_H */