blob: b4d21be6f01520ba188f851496d62f4c4df45cc2 [file] [log] [blame]
Guido van Rossum9f650811999-12-20 21:22:24 +00001#ifndef Py_IMPORTDL_H
2#define Py_IMPORTDL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
Guido van Rossum1ae940a1995-01-02 19:04:15 +00008
9/* Definitions for dynamic loading of extension modules */
Guido van Rossumaee0bad1997-09-05 07:33:22 +000010enum filetype {
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000011 SEARCH_ERROR,
12 PY_SOURCE,
13 PY_COMPILED,
14 C_EXTENSION,
15 PY_RESOURCE, /* Mac only */
16 PKG_DIRECTORY,
17 C_BUILTIN,
18 PY_FROZEN,
19 PY_CODERESOURCE, /* Mac only */
20 IMP_HOOK
Guido van Rossumaee0bad1997-09-05 07:33:22 +000021};
Guido van Rossum1ae940a1995-01-02 19:04:15 +000022
Guido van Rossum9f650811999-12-20 21:22:24 +000023struct filedescr {
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000024 char *suffix;
25 char *mode;
26 enum filetype type;
Guido van Rossum9f650811999-12-20 21:22:24 +000027};
28extern struct filedescr * _PyImport_Filetab;
29extern const struct filedescr _PyImport_DynLoadFiletab[];
Guido van Rossum1ae940a1995-01-02 19:04:15 +000030
Tim Petersdbd9ba62000-07-09 03:09:57 +000031extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000032 FILE *);
Guido van Rossum1ae940a1995-01-02 19:04:15 +000033
Guido van Rossumef3d02e1997-07-21 14:54:36 +000034/* Max length of module suffix searched for -- accommodates "module.slb" */
35#define MAXSUFFIXSIZE 12
Guido van Rossum9f650811999-12-20 21:22:24 +000036
37#ifdef MS_WINDOWS
Guido van Rossum95288861999-12-20 22:55:03 +000038#include <windows.h>
Guido van Rossum9f650811999-12-20 21:22:24 +000039typedef FARPROC dl_funcptr;
40#else
Andrew MacIntyred9400542002-02-26 11:41:34 +000041#if defined(PYOS_OS2) && !defined(PYCC_GCC)
Tim Peters603c6832001-11-05 02:45:59 +000042#include <os2def.h>
Guido van Rossum9f650811999-12-20 21:22:24 +000043typedef int (* APIENTRY dl_funcptr)();
44#else
45typedef void (*dl_funcptr)(void);
46#endif
47#endif
48
49
50#ifdef __cplusplus
51}
52#endif
53#endif /* !Py_IMPORTDL_H */