Issue #5812: The two-argument form of the Fraction constructor
[python.git] / Python / dynload_atheos.c
blob6f4df73c3b9fea79b739ed9b0ca19be3caa612ef
2 /* Support for dynamic loading of extension modules */
4 #include <atheos/image.h>
5 #include <errno.h>
7 #include "Python.h"
8 #include "importdl.h"
11 const struct filedescr _PyImport_DynLoadFiletab[] = {
12 {".so", "rb", C_EXTENSION},
13 {"module.so", "rb", C_EXTENSION},
14 {0, 0}
17 dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
18 const char *pathname, FILE *fp)
20 void *p;
21 int lib;
22 char funcname[258];
24 if (Py_VerboseFlag)
25 printf("load_library %s\n", pathname);
27 lib = load_library(pathname, 0);
28 if (lib < 0) {
29 char buf[512];
30 if (Py_VerboseFlag)
31 perror(pathname);
32 PyOS_snprintf(buf, sizeof(buf), "Failed to load %.200s: %.200s",
33 pathname, strerror(errno));
34 PyErr_SetString(PyExc_ImportError, buf);
35 return NULL;
37 PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname);
38 if (Py_VerboseFlag)
39 printf("get_symbol_address %s\n", funcname);
40 if (get_symbol_address(lib, funcname, -1, &p) < 0) {
41 p = NULL;
42 if (Py_VerboseFlag)
43 perror(funcname);
46 return (dl_funcptr) p;