blob: 2606e1e32fd5148148aca8661003f6916859cb8a [file] [log] [blame]
Guido van Rossum22a1d361999-12-20 21:18:49 +00001
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 Woutersb4bd21c2000-07-22 23:38:01 +000010extern char *Py_GetProgramName(void);
Guido van Rossum22a1d361999-12-20 21:18:49 +000011
12const struct filedescr _PyImport_DynLoadFiletab[] = {
13 {".o", "rb", C_EXTENSION},
14 {"module.o", "rb", C_EXTENSION},
15 {0, 0}
16};
17
18
Guido van Rossum96a8fb71999-12-22 14:09:35 +000019dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
Guido van Rossum22a1d361999-12-20 21:18:49 +000020 const char *pathname, FILE *fp)
21{
Guido van Rossum96a8fb71999-12-22 14:09:35 +000022 char funcname[258];
23
Martin v. Löwis1a214512008-06-11 05:26:20 +000024 PyOS_snprintf(funcname, sizeof(funcname), "PyInit_%.200s", shortname);
Guido van Rossum22a1d361999-12-20 21:18:49 +000025 return dl_loadmod(Py_GetProgramName(), pathname, funcname);
26}