Guido van Rossum | 22a1d36 | 1999-12-20 21:18:49 +0000 | [diff] [blame] | 1 | |
| 2 | /* Support for dynamic loading of extension modules */ |
| 3 | |
| 4 | #include "dl.h" |
| 5 | |
| 6 | #include "Python.h" |
| 7 | #include "importdl.h" |
| 8 | |
| 9 | |
Thomas Wouters | b4bd21c | 2000-07-22 23:38:01 +0000 | [diff] [blame] | 10 | extern char *Py_GetProgramName(void); |
Guido van Rossum | 22a1d36 | 1999-12-20 21:18:49 +0000 | [diff] [blame] | 11 | |
| 12 | const struct filedescr _PyImport_DynLoadFiletab[] = { |
| 13 | {".o", "rb", C_EXTENSION}, |
| 14 | {"module.o", "rb", C_EXTENSION}, |
| 15 | {0, 0} |
| 16 | }; |
| 17 | |
| 18 | |
Guido van Rossum | 96a8fb7 | 1999-12-22 14:09:35 +0000 | [diff] [blame] | 19 | dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, |
Guido van Rossum | 22a1d36 | 1999-12-20 21:18:49 +0000 | [diff] [blame] | 20 | const char *pathname, FILE *fp) |
| 21 | { |
Guido van Rossum | 96a8fb7 | 1999-12-22 14:09:35 +0000 | [diff] [blame] | 22 | char funcname[258]; |
| 23 | |
| 24 | sprintf(funcname, "init%.200s", shortname); |
Guido van Rossum | 22a1d36 | 1999-12-20 21:18:49 +0000 | [diff] [blame] | 25 | return dl_loadmod(Py_GetProgramName(), pathname, funcname); |
| 26 | } |