update peek documentation to implementation
[python/dscho.git] / Python / dynload_atheos.c
blobb01fdfa004b16e4ddb45a3a469f1fcea5089058f
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), "PyInit_%.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;