blob: a4e5c0e69f4e016a5a9c3f17a3faa189a09c8814 [file] [log] [blame]
Guido van Rossumf70e43a1991-02-19 12:39:46 +00001
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00002/* Module definition and import interface */
3
Fred Drake5eb6d4e2000-07-08 23:37:28 +00004#ifndef Py_IMPORT_H
5#define Py_IMPORT_H
6#ifdef __cplusplus
7extern "C" {
8#endif
Guido van Rossum34679b71993-01-26 13:33:44 +00009
Mark Hammond8235ea12002-07-19 06:55:41 +000010PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
11PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co);
12PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
Fred Drake5eb6d4e2000-07-08 23:37:28 +000013 char *name, PyObject *co, char *pathname);
Mark Hammond8235ea12002-07-19 06:55:41 +000014PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
Jeremy Hyltonaf68c872005-12-10 18:50:16 +000015PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name);
16PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name);
Thomas Woutersf7f438b2006-02-28 16:09:29 +000017PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name,
18 PyObject *globals, PyObject *locals, PyObject *fromlist, int level);
19
20/* For DLL compatibility */
21#undef PyImport_ImportModuleEx
Mark Hammond8235ea12002-07-19 06:55:41 +000022PyAPI_FUNC(PyObject *) PyImport_ImportModuleEx(
Fred Drake5eb6d4e2000-07-08 23:37:28 +000023 char *name, PyObject *globals, PyObject *locals, PyObject *fromlist);
Thomas Woutersf7f438b2006-02-28 16:09:29 +000024#define PyImport_ImportModuleEx(n, g, l, f) \
25 PyImport_ImportModuleLevel(n, g, l, f, -1);
26
Mark Hammond8235ea12002-07-19 06:55:41 +000027PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
28PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
29PyAPI_FUNC(void) PyImport_Cleanup(void);
30PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *);
Fred Drake5eb6d4e2000-07-08 23:37:28 +000031
Raymond Hettingerdb29e0f2004-10-07 06:46:25 +000032PyAPI_FUNC(struct filedescr *) _PyImport_FindModule(
33 const char *, PyObject *, char *, size_t, FILE **, PyObject **);
34PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *);
Guido van Rossum8ee3e5a2005-09-14 18:09:42 +000035PyAPI_FUNC(void) _PyImport_ReInitLock(void);
Raymond Hettingerdb29e0f2004-10-07 06:46:25 +000036
Mark Hammonda2905272002-07-29 13:42:14 +000037PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *);
38PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *);
Guido van Rossum29e46a91997-08-02 02:56:48 +000039
Guido van Rossum39c2aae1996-05-22 17:25:28 +000040struct _inittab {
Fred Drake5eb6d4e2000-07-08 23:37:28 +000041 char *name;
Thomas Wouters5f375912000-07-22 23:30:03 +000042 void (*initfunc)(void);
Guido van Rossum39c2aae1996-05-22 17:25:28 +000043};
44
Mark Hammonda2905272002-07-29 13:42:14 +000045PyAPI_DATA(struct _inittab *) PyImport_Inittab;
Guido van Rossuma3309961993-07-28 09:05:47 +000046
Mark Hammonda2905272002-07-29 13:42:14 +000047PyAPI_FUNC(int) PyImport_AppendInittab(char *name, void (*initfunc)(void));
48PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab);
Guido van Rossum16926bd1998-06-29 20:34:46 +000049
Guido van Rossum4ee68d91996-06-17 17:05:01 +000050struct _frozen {
Fred Drake5eb6d4e2000-07-08 23:37:28 +000051 char *name;
52 unsigned char *code;
53 int size;
Guido van Rossum4ee68d91996-06-17 17:05:01 +000054};
55
56/* Embedding apps may change this pointer to point to their favorite
57 collection of frozen modules: */
58
Mark Hammonda2905272002-07-29 13:42:14 +000059PyAPI_DATA(struct _frozen *) PyImport_FrozenModules;
Guido van Rossum4ee68d91996-06-17 17:05:01 +000060
Guido van Rossuma3309961993-07-28 09:05:47 +000061#ifdef __cplusplus
62}
63#endif
64#endif /* !Py_IMPORT_H */