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 | |
Brett Cannon | 2657df4 | 2012-05-04 15:20:40 -0400 | [diff] [blame] | 12 | const char *_PyImport_DynLoadFiletab[] = {".o", NULL}; |
Guido van Rossum | 22a1d36 | 1999-12-20 21:18:49 +0000 | [diff] [blame] | 13 | |
| 14 | |
Nick Coghlan | d5cacbb | 2015-05-23 22:24:10 +1000 | [diff] [blame] | 15 | dl_funcptr _PyImport_FindSharedFuncptr(const char *prefix, |
| 16 | const char *shortname, |
| 17 | const char *pathname, FILE *fp) |
Guido van Rossum | 22a1d36 | 1999-12-20 21:18:49 +0000 | [diff] [blame] | 18 | { |
Victor Stinner | 3eeee83 | 2011-02-23 11:29:28 +0000 | [diff] [blame] | 19 | char funcname[258]; |
Guido van Rossum | 96a8fb7 | 1999-12-22 14:09:35 +0000 | [diff] [blame] | 20 | |
Steve Dower | adc2fb8 | 2015-05-23 14:13:41 -0700 | [diff] [blame] | 21 | PyOS_snprintf(funcname, sizeof(funcname), "%.20s_%.200s", prefix, shortname); |
Victor Stinner | 3eeee83 | 2011-02-23 11:29:28 +0000 | [diff] [blame] | 22 | return dl_loadmod(Py_GetProgramName(), pathname, funcname); |
Guido van Rossum | 22a1d36 | 1999-12-20 21:18:49 +0000 | [diff] [blame] | 23 | } |