import.h 1.98 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(long) PyImport_GetMagicNumber(void);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
13
	char *name, PyObject *co, char *pathname);
14
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
15 16
PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
17 18 19 20 21
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
	PyObject *globals, PyObject *locals, PyObject *fromlist, int level);

/* For DLL compatibility */
#undef PyImport_ImportModuleEx
22
PyAPI_FUNC(PyObject *) PyImport_ImportModuleEx(
23
	char *name, PyObject *globals, PyObject *locals, PyObject *fromlist);
24 25 26
#define PyImport_ImportModuleEx(n, g, l, f) \
	PyImport_ImportModuleLevel(n, g, l, f, -1);

27 28 29 30
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
PyAPI_FUNC(void) PyImport_Cleanup(void);
PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
31

32 33 34
PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
	const char *, PyObject *, char *, size_t, FILE **, PyObject **);
PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
35
PyAPI_FUNC(void) _PyImport_ReInitLock(void);
36

37 38
PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
39

40
struct _inittab {
41
    char *name;
42
    void (*initfunc)(void);
43 44
};

45
PyAPI_DATA(struct _inittab *) PyImport_Inittab;
46

47 48
PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void));
PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
49

50
struct _frozen {
51 52 53
    char *name;
    unsigned char *code;
    int size;
54 55 56 57 58
};

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

59
PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
60

61 62 63 64
#ifdef __cplusplus
}
#endif
#endif /* !Py_IMPORT_H */